Hello. I have a variable that I pass as a hidden parameter from a dtml document to a dtml method(this variable is a counter and is passed to the dtml method when a form(the dtml document) is submiited). I would like to use the value of this variable as the Endvalue of the range method that is used with the dtml-in tag. I have tried both of the following but they don't work and give the error listed below: <dtml-in "_.range(Request.form['counter'])"> <dtml-in "_.range(Request.get('counter'))"> Error Type: NameError Error Value: global name 'Request' is not defined The variable is being passed correctly and I have confirmed this by using the following: <dtml-var "REQUEST.form['counter']"> Any help would be greatly appreciated. Thanks. - Asad
Hi Python is case sensitive!!! It's <dtml-in "_.range(REQUEST.form['counter'])"> not <dtml-in "_.range(Request.form['counter'])"> dragos ----- Original Message ----- From: "Asad Habib" <ahabib@engin.umich.edu> To: <zope@zope.org> Sent: Wednesday, January 07, 2004 6:13 PM Subject: [Zope] Range Function of dtml-in tag
Hello. I have a variable that I pass as a hidden parameter from a dtml document to a dtml method(this variable is a counter and is passed to the dtml method when a form(the dtml document) is submiited). I would like to use the value of this variable as the Endvalue of the range method that is used with the dtml-in tag. I have tried both of the following but they don't work and give the error listed below:
<dtml-in "_.range(Request.form['counter'])"> <dtml-in "_.range(Request.get('counter'))">
Error Type: NameError Error Value: global name 'Request' is not defined
The variable is being passed correctly and I have confirmed this by using the following: <dtml-var "REQUEST.form['counter']">
Any help would be greatly appreciated. Thanks.
- Asad
_______________________________________________ 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 )
Hello. Thanks. I tried that and now I am getting a type error. Is there any way around this? Zope does not allow me to provide a variable for the EndValue of the range method for the dtml-in tag. - Asad On Wed, 7 Jan 2004, Dragos Chirila wrote:
Hi
Python is case sensitive!!!
It's
<dtml-in "_.range(REQUEST.form['counter'])">
not
<dtml-in "_.range(Request.form['counter'])">
dragos
----- Original Message ----- From: "Asad Habib" <ahabib@engin.umich.edu> To: <zope@zope.org> Sent: Wednesday, January 07, 2004 6:13 PM Subject: [Zope] Range Function of dtml-in tag
Hello. I have a variable that I pass as a hidden parameter from a dtml document to a dtml method(this variable is a counter and is passed to the dtml method when a form(the dtml document) is submiited). I would like to use the value of this variable as the Endvalue of the range method that is used with the dtml-in tag. I have tried both of the following but they don't work and give the error listed below:
<dtml-in "_.range(Request.form['counter'])"> <dtml-in "_.range(Request.get('counter'))">
Error Type: NameError Error Value: global name 'Request' is not defined
The variable is being passed correctly and I have confirmed this by using the following: <dtml-var "REQUEST.form['counter']">
Any help would be greatly appreciated. Thanks.
- Asad
_______________________________________________ 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 )
_______________________________________________ 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 )
provide a example how to reproduce this and *ensure* that the parameters are of type *int*. don't try to pass a *string* as argument. -aj --On Mittwoch, 7. Januar 2004 12:04 Uhr -0500 Asad Habib <ahabib@engin.umich.edu> wrote:
Hello. Thanks. I tried that and now I am getting a type error. Is there any way around this? Zope does not allow me to provide a variable for the EndValue of the range method for the dtml-in tag.
- Asad
On Wed, 7 Jan 2004, Dragos Chirila wrote:
Hi
Python is case sensitive!!!
It's
<dtml-in "_.range(REQUEST.form['counter'])">
not
<dtml-in "_.range(Request.form['counter'])">
dragos
----- Original Message ----- From: "Asad Habib" <ahabib@engin.umich.edu> To: <zope@zope.org> Sent: Wednesday, January 07, 2004 6:13 PM Subject: [Zope] Range Function of dtml-in tag
Hello. I have a variable that I pass as a hidden parameter from a dtml document to a dtml method(this variable is a counter and is passed to the dtml method when a form(the dtml document) is submiited). I would like to use the value of this variable as the Endvalue of the range method that is used with the dtml-in tag. I have tried both of the following but they don't work and give the error listed below:
<dtml-in "_.range(Request.form['counter'])"> <dtml-in "_.range(Request.get('counter'))">
Error Type: NameError Error Value: global name 'Request' is not defined
The variable is being passed correctly and I have confirmed this by using the following: <dtml-var "REQUEST.form['counter']">
Any help would be greatly appreciated. Thanks.
- Asad
_______________________________________________ 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 )
_______________________________________________ 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 )
_______________________________________________ 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 )
On Wed, 2004-01-07 at 09:04, Asad Habib wrote:
Hello. Thanks. I tried that and now I am getting a type error. Is there any way around this? Zope does not allow me to provide a variable for the EndValue of the range method for the dtml-in tag.
Sure it does. The following works fine: ---- <dtml-in "_.range(10,15)" prefix=num> <dtml-var num_item> </dtml-in> ---- My guess is you're passing a string value as an argument to range, which won't work for obvious reasons. As a general principle, start with something that works with "dummy" values and once that works, try inserting the variables you want to use. You'll have a much easier time figuring out what does and doesn't work. Also, each time you have a new problem, you should show what code you're currently using. HTH, Dylan
participants (4)
-
Andreas Jung -
Asad Habib -
Dragos Chirila -
Dylan Reinhardt