I'm currently trying to add a new folder to an old folder, using input from a calling form, then add two properties to that new folder. I searched the mailing list, and came up with an example that led me to the following, but I'm still getting "Error Type: NameError" "Error Value: manage_addProperty". Where is my mistake? <dtml-comment> The following line works as expected.</dtml-comment> <dtml-call "manage_addFolder(name)"> <dtml-comment>Something below here isn't right.</dtml-comment> <dtml-with "_.getitem(name)"> <dtml-call "manage_addProperty(id='number', value=number, type='int')"> <dtml-call "magage_addProperty(id='exp_date', value=exp_date, type='date')"> </dtml-with> <dtml-call "RESPONSE.redirect(URL1)"> Thanks for you help! Gary.
As an aside: I can get the mess below to work with a python script, BUT, I don't know how to do the URL redirect with python as it's listed in the DTML Method. (python script snippet) context.manage_addFolder(name, name) doc=getattr(context, name) doc.manage_addProperty('number', number, 'int') doc.manage_addProperty('exp_date', exp_date, 'date') How would I do the URL redirect using an equivalent to the <dtml-call "RESPONSE.redirect(URL1)"> that's in the DTML Method below? Many thanks again for your time and effort. Gary. Gary Lowder wrote:
I'm currently trying to add a new folder to an old folder, using input from a calling form, then add two properties to that new folder. I searched the mailing list, and came up with an example that led me to the following, but I'm still getting "Error Type: NameError" "Error Value: manage_addProperty".
Where is my mistake?
<dtml-comment> The following line works as expected.</dtml-comment>
<dtml-call "manage_addFolder(name)">
<dtml-comment>Something below here isn't right.</dtml-comment>
<dtml-with "_.getitem(name)"> <dtml-call "manage_addProperty(id='number', value=number, type='int')"> <dtml-call "magage_addProperty(id='exp_date', value=exp_date, type='date')"> </dtml-with>
<dtml-call "RESPONSE.redirect(URL1)">
Thanks for you help! Gary.
_______________________________________________ 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 )
with your line dropped in, my python script still gives me: Error Type: AttributeError Error Value: RESPONSE I'm passing variables via a <form action...>, how do I let python access that namespace? Thanks, Gary. Chris Withers wrote:
How would I do the URL redirect using an equivalent to the <dtml-call "RESPONSE.redirect(URL1)"> that's in the DTML Method below?
context.RESPONSE.redirect(URL1)
cheers,
Chris
Chris Withers wrote:
How would I do the URL redirect using an equivalent to the <dtml-call "RESPONSE.redirect(URL1)"> that's in the DTML Method below?
context.RESPONSE.redirect(URL1)
D'Oh... Either replace it with: context.REQUEST.RESPONSE.redirect(URL1) ...or do the following: -Go to the bindings tab and bind _ to the Namespace. -Then do _.RESPONSE.redirect(URL1) cheers, Chris
I really appreciate your help, but I continue to have problems with this line, and this is turning into a quest of sorts ;) . When I use "context.REQUEST.RESPONSE.redirect(URL1)" in my python script I get "NameError URL1". When I bind _ as you suggested, and use "_.RESPONSE.redirect(URL1)" I get "AttributeError RESPONSE". I'm confused, but very grateful for your help so far. Gary. Chris Withers wrote:
Chris Withers wrote:
How would I do the URL redirect using an equivalent to the <dtml-call "RESPONSE.redirect(URL1)"> that's in the DTML Method below?
context.RESPONSE.redirect(URL1)
D'Oh...
Either replace it with:
context.REQUEST.RESPONSE.redirect(URL1)
...or do the following:
-Go to the bindings tab and bind _ to the Namespace. -Then do _.RESPONSE.redirect(URL1)
cheers,
Chris
Gary Lowder wrote:
When I use "context.REQUEST.RESPONSE.redirect(URL1)" in my python script I get "NameError URL1".
That should be: RESPONSE = context.REQUEST.RESPONSE URL1 = context.REQUEST['URL1'] RESPONSE.redirect(URL1)
When I bind _ as you suggested, and use "_.RESPONSE.redirect(URL1)" I get "AttributeError RESPONSE".
Try _['RESPONSE'].redirect(_['URL1']) errr... maybe DTML wasn't so bad afterall ;-) *sigh* Chris
participants (2)
-
Chris Withers -
Gary Lowder