[Zope] Namespace ?
Jim Fulton
jim@digicool.com
Thu, 23 Dec 1999 10:13:40 -0500
Brenton Bills wrote:
>
> Hi people,
> I am new to zope and am having a few problems in regard to
> namespaces (I think).
>
> I am using code similar to the following but I get,
> Error Type: KeyError,
> Error value: unique.
>
> I have created a dtml method with the following code...
>
> <dtml-let unique="whrandom.random()">
>
> <dtml-in InsertIntoDB>
> </dtml-in>
>
> </dtml-let>
>
> I have a mysql database and the insert statement InsertIntoDB as follows,
>
> insert into randoms
> (
> <dtml-var unique>
> )
>
> I have had a look at the howtos but it still makes it as clear as mud.
SQL methods don't automagically get the namespace from a calling
DTML method passed in. (Maybe they should....)
You could pass the namespace in yourself:
<dtml-in expr="InsertIntoDB(_)">
or you could pass unique in:
<dtml-in expr="InsertIntoDB(unique=whrandom.random())">
Note that you currently can't pass a namespace *and* pass
keyword arguments.
Also note that arguments to SQL methods are used *only* if they are
formally named in the SQL arguments list.
Jim
--
Jim Fulton mailto:jim@digicool.com Python Powered!
Technical Director (888) 344-4332 http://www.python.org
Digital Creations http://www.digicool.com http://www.zope.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.