[Zope] Help: dtml-var expr -> DTML method -> ZSQL method

Mayers, Philip J p.mayers@ic.ac.uk
Mon, 12 Feb 2001 10:44:59 -0000


The DTML method call:

    <dtml-var expr="get_rid()">

Will call get_rid without a "namespace", so get_rid can't lookup next_rid,
and therefore it fails. Try this:

    <dtml-var expr="get_rid(_.None, _)">

Try the Zope "Help" link from the management interface, go "Zope Help",
"Zope API", "DTML Method", and lookup the API for __call__:

__call__(client=None, REQUEST={}, **kw): 


So, clearly this will work:

    <dtml-var expr="get_rid(_.None, REQUEST)">

Namespaces are hard!

Regards,
Phil

+----------------------------------+
| Phil Mayers, Network Support     |
| Centre for Computing Services    |
| Imperial College                 |
+----------------------------------+  

-----Original Message-----
From: Martin Andrews [mailto:mandrews@netgenics.com]
Sent: 11 February 2001 19:58
To: zope@zope.org
Subject: [Zope] Help: dtml-var expr -> DTML method -> ZSQL method


Confused by acquisition again (I think). I have a ZSQL that gets the next
value
from a postgres sequence - it has no arguments and the following body - name
is
"next_rid":

    select nextval('reservation_id')

I then have a DTML method that returns just the integer result - name is
"get_rid":

    <dtml-return expr="next_rid()[0]['nextval']">

Both of these work fine, and I can put "<dtml-var get_rid>" in another DTML
method and it works fine. What does not work is:

    <dtml-var expr="get_rid()">

Calling from a expression give me a NameError for next_rid.

Help - what am I missing.

Martin

--
Martin Andrews, mandrews@netgenics.com




_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )