Hi All: I'm using the following code to create a page along with the following properties, however only the page is created the property isn't. What should I do: <dtml-with "resources.test_forum.posts"> <dtml-call expr="addDTMLDocument(id=REQUEST['topic'], title=REQUEST['topic']) and manage_addProperty('name', REQUEST['poster'], 'string')"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> Thanks, Todd
Try this: <dtml-with "resources.test_forum.posts"> <dtml-call expr="addDTMLDocument(id=REQUEST['topic'], title=REQUEST['topic'])"> <dtml-call expr="manage_addProperty('name', REQUEST['poster'], 'string')"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')"> At 10:26 AM 12/13/2001, Todd Loomis wrote:
Hi All:
I'm using the following code to create a page along with the following properties, however only the page is created the property isn't. What should I do:
<dtml-with "resources.test_forum.posts"> <dtml-call expr="addDTMLDocument(id=REQUEST['topic'], title=REQUEST['topic']) and manage_addProperty('name', REQUEST['poster'], 'string')"> </dtml-with> <dtml-call "RESPONSE.redirect('./index_html')">
Thanks, Todd
_______________________________________________ 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 )
Todd Loomis writes:
I'm using the following code to create a page along with the following properties, however only the page is created the property isn't. What should I do:
<dtml-with "resources.test_forum.posts"> <dtml-call expr="addDTMLDocument(id=REQUEST['topic'], title=REQUEST['topic']) and manage_addProperty('name', REQUEST['poster'], 'string')"> </dtml-with> Your "manage_addProperty" operates on the current object and not the newly created one.
Use: <dtml-let newid="REQUEST['topic']"> <dtml-call expr="addDTMLDocument(id=newid,title=REQUEST['topic'])"> <dtml-with expr="_.getitem(newid)"> <dtml-call expr="manage_addProperty('name',REQUEST['poster'], 'string')"> </dtml-with> </dtml-let> Dieter
Your "manage_addProperty" operates on the current object and not the newly created one.
Use:
<dtml-let newid="REQUEST['topic']"> <dtml-call expr="addDTMLDocument(id=newid,title=REQUEST['topic'])"> <dtml-with expr="_.getitem(newid)"> <dtml-call expr="manage_addProperty('name',REQUEST['poster'], 'string')"> </dtml-with> </dtml-let>
And by the way you should really write this kind of code in python script, not DTML: newid = REQUEST['topic'] context.addDTMLDocument(id=newid, title=REQUEST['topic']) newobj = getattr(context, newid) newobj.manage_addProperty('name', REQUEST['poster'], 'string') Florent -- Florent Guillaume, Nuxeo (Paris, France) +33 1 40 33 79 10 http://nuxeo.com mailto:fg@nuxeo.com
participants (4)
-
Dieter Maurer -
Florent Guillaume -
Steven Turoff -
Todd Loomis