[Zope] REQUEST.has_key does not find passed argument

2005-08-25 Thread Santani Teng

Hello,

I'm new to Zope, Python and DTML and could therefore use some help.
I have a page in which I want to pass an argument to a new DTML method 
when clicking a link. The relevant snippet is:


a href=/contact?name_id:int=dtml-var name_idContact/a

So, when you click on Contact you should get a new window. The 
variable name_id is previously established on the page and shows up 
correctly when the pointer hovers over the link, i.e. the status bar at 
the bottom of the browser reads:


http://server.website.edu/contact?name_id:int=3

However, the DTML code for the new page doesn't seem to find this value 
and returns a message telling me that no name was found. Because I am 
stuck, here is the virtual entirety of the code:


dtml-if not REQUEST.has_key('name_id')
No name was found. Please specify a name.
dtml-else
Thank you! The request has been made.
/dtml-if

How can I get this page to recognize the passed argument so I can call a 
method with it?


I have seen similar threads here on this topic but was unable to find a 
solution from reading them. I am also baffled by the fact that in large 
part I'm reusing the same code that seems to work perfectly in the same 
format on other pages (which I didn't write). This is probably something 
very simple, but I would really appreciate a hand.


Thanks in advance,

Santani


___
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 )


Re: [Zope] REQUEST.has_key does not find passed argument

2005-08-25 Thread Jonathan


- Original Message - 
From: Santani Teng [EMAIL PROTECTED]

To: zope@zope.org
Sent: Thursday, August 25, 2005 4:27 AM
Subject: [Zope] REQUEST.has_key does not find passed argument



Hello,

I'm new to Zope, Python and DTML and could therefore use some help.
I have a page in which I want to pass an argument to a new DTML method 
when clicking a link. The relevant snippet is:


a href=/contact?name_id:int=dtml-var name_idContact/a

So, when you click on Contact you should get a new window. The variable 
name_id is previously established on the page and shows up correctly 
when the pointer hovers over the link, i.e. the status bar at the bottom 
of the browser reads:


http://server.website.edu/contact?name_id:int=3

However, the DTML code for the new page doesn't seem to find this value 
and returns a message telling me that no name was found. Because I am 
stuck, here is the virtual entirety of the code:


dtml-if not REQUEST.has_key('name_id')
No name was found. Please specify a name.
dtml-else
Thank you! The request has been made.
/dtml-if

How can I get this page to recognize the passed argument so I can call a 
method with it?


I have seen similar threads here on this topic but was unable to find a 
solution from reading them. I am also baffled by the fact that in large 
part I'm reusing the same code that seems to work perfectly in the same 
format on other pages (which I didn't write). This is probably something 
very simple, but I would really appreciate a hand.


Your code looked ok to me so I ran a quick test using two small dtml 
methods:


dtml method 'tst':

dtml-var standard_html_header
br
dtml-let name_id=3
a href=tst2?name_id:int=dtml-var name_idclick here/a
/dtml-let
br
br
dtml-var standard_html_footer


dtml method 'tst2':

dtml-var standard_html_header
dtml-if not REQUEST.has_key('name_id')
No name was found. Please specify a name.
dtml-else
Thank you! The request has been made.
/dtml-if
dtml-var standard_html_footer


When you run tst and then click on the 'click here' link the message 'Thank 
you! The request has been made.' appears.  Therefore your code is working as 
expected.


The only thing I can think of is that your dtml method called 'contact' is 
not being invoked properly (do you have more than 1 contact method - perhaps 
in different folders?).  Also, try removing the '/' in front of the 
'contact' in the href attribute of your html link.


hth

Jonathan 



___
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 )