Here's what you're trying to do: <dtml-call "REQUEST.set('some_var', some_function())"> <dtml-call "REQUEST.set('some_var', some_other_function(some_var))"> That's not going to work. Unlike Python, DTML doesn't seem to like using a variable in an expression whose output is stored in the same variable. Maybe somebody smarter could offer an explanation why not. Anyway... what you want to do is: <dtml-call "REQUEST.set('some_var', some_function())"> <dtml-call "REQUEST.set('some_temp', some_var)"> <dtml-call "REQUEST.set('some_var', some_other_function(some_temp))"> Sad but true... unless there's a better workaround I don't know about. HTH, Dylan On Tue, 2003-07-15 at 12:35, zoper@disturbance.dhs.org wrote:
Greetings:
I realize I am likely doing stuff in the cruftiest way possible: Rather than flame if you have the urge, a link to specifics on better ways to do what I am doing would be appreciated.
I have a set of external methods that do some stuff to create and build an XML document. I am also doing a lot of logic in DTML and passing stuff back and forth to these external methods. A great simplification of what I am doing:
---------------------- <dtml-call expr="REQUEST.set('myxmldoc',createxmldoc())"> <!-- createxmldoc is an external method that creates a (minidom) Document() and adds a root node. They are returned as a tuple, i.e. myxmldoc[0] will be the xml doc object and myxmldoc[1] will be the node-->
<!-- dtml logic that gets some info from a database -->
<dtml-call expr="REQUEST.set('myxmldoc',addanode(myxmldoc[0],myxmldoc[1],databasevar)"> <!-- in the line above, databasevar is some info from my DB, and addanode is an external method... --> ----------------------
The problem is, that when I do this, re-using the myxmldoc var causes a __getitem__ attribute error. I have to use a new name, i.e. modxmldoc, to get around the error.
OK, I thought, fine, so long as I can kill the original myxmldoc object, as I have many iterations of this and I do not want to end up with a huge amount of objects in memory, getting larger and larger. However, I can't figure out how to 'unset' myxmldoc - setting it to '' doesn't work, I get a string index out of range error. If I specifically set myxmldoc[0] and myxmldoc[1] to '', that works, but I still get the __getitem__ error when I attempt to re-use the variable.
Suggestions?
TIA, Bryan
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )