Hello all, In python I would normally do the following to make a associative array (with an element that is a list) empty: thing['items'] = [] This seems like such a minor thing to do, but I can't seem to get this to work with DTML. How would I do the equivalent in DTML??? I've tried using REQUEST.set() and also just a straight dtml-call expression, and neither seemed to work. I'd appreciate some help or guidance. ~Mark
Try: <dtml-call "thing.update({'items':[]})"> HTH, Dylan On Thu, 2003-06-26 at 13:24, Mark Nenadov wrote:
Hello all,
In python I would normally do the following to make a associative array (with an element that is a list) empty:
thing['items'] = []
This seems like such a minor thing to do, but I can't seem to get this to work with DTML. How would I do the equivalent in DTML??? I've tried using REQUEST.set() and also just a straight dtml-call expression, and neither seemed to work.
I'd appreciate some help or guidance.
~Mark
_______________________________________________ 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 )
Dylan, Thanks for the tip. It didn't work, though. Apparently the "thing" that I assumed to be a 'dict' isn't really one. It works just like a 'dict' (thing['items']), but it is actually an object instance. I did find a solution, indirectly. I've discovered that if I use a one-liner TALES expression with the Formulator product, I can accomplish what I was eventually trying to accomplish by emptying the array and refilling it. So, I don't even need to empty the array at all now. Anyways, problem solved. Thanks to everyone on the list who replied. ~Mark On Thu, 2003-06-26 at 16:57, Dylan Reinhardt wrote:
Try:
<dtml-call "thing.update({'items':[]})">
HTH,
Dylan
On Thu, Jun 26, 2003 at 04:24:16PM -0400, Mark Nenadov wrote:
Hello all,
In python I would normally do the following to make a associative array (with an element that is a list) empty:
thing['items'] = []
This seems like such a minor thing to do, but I can't seem to get this to work with DTML. How would I do the equivalent in DTML??? I've tried using REQUEST.set() and also just a straight dtml-call expression, and neither seemed to work.
I'd appreciate some help or guidance.
Maybe you could tell us what you're trying to achieve, rather than how you're trying to do it? In general, mucking around with data structures should be done in a Script (Python) and not in a DTML method/document. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's ROBOT SPOON! (random hero from isometric.spaceninja.com)
participants (3)
-
Dylan Reinhardt -
Mark Nenadov -
Paul Winkler