Re: [Zope] Python Scripts and HTML Forms
Hi Jonathan,Thanks a lot, it works today, but it was acting up a bit yesterday. I really appreciate it, maybe I just needed to completely get rid of the browser cache.Peace and thanks again,Muk On 8/17/06, Jonathan <[EMAIL PROTECTED]> wrote: If you have a line like in your html file then if you try the following in your script file print REQUEST['first_name'] return printed you should see "default value" printed out you can try: print REQUEST to see the entire contents of REQUEST (very informative) Note: if you do not have a default value in your statement and you do not enter anything in the input field when the form is displayed, then when the form is submitted REQUEST will not contain an entry for the corresponding form field (an entry is made in REQUEST only when data is entered in the form field) Jonathan - Original Message - From: Muk Yan To: Jonathan Cc: zope@zope.org Sent: Thursday, August 17, 2006 4:40 PM Subject: Re: [Zope] Python Scripts and HTML Forms Hey All,Sorry about that, what I meant is that I get a KeyError. It says that the first_name in REQUEST['first_name'] is not found, when I try to set the variable in line in the script where fname = REQUEST['first_name'].Thanks in advance.Cheers,Muk On 8/17/06, Jonathan < [EMAIL PROTECTED]> wrote: What does "it doesn't seem to work" mean? Error messages/traceback? What does your form & script contain? More info on the problem is definitely required! Jonathan - Original Message - From: Muk Yan To: Jonathan ; zope@zope.org Sent: Thursday, August 17, 2006 4:20 PM Subject: Re: [Zope] Python Scripts and HTML Forms Hey Jonathan, All,Thanks I tried your solution, but it doesn't seem to work. Can anybody shed some more light on this situation, since what Jonathan provides is exactly what I want to do, but it's not working.Am I forgetting to put parameteres or some other newbie mistake like that?Thanks in advance and thanks again Jonathan.-Muk On 8/17/06, Jonathan <[EMAIL PROTECTED]> wrote: Form variables are stored in REQUEST. In a python script you gain access to REQUEST by: REQUEST = container.REQUEST you can then access the form variables by: fname = REQUEST['first_name'] you can check for the presence of a form variable by if REQUEST.has_key('first_name'): or if REQUEST.get('first_name', None): hth Jonathan - Original Message - From: Muk Yan To: zope@zope.org Sent: Thursday, August 17, 2006 2:57 PM Subject: [Zope] Python Scripts and HTML Forms Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___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 )
Re: [Zope] Python Scripts and HTML Forms
At Thursday 17/8/2006 17:40, Muk Yan wrote: Sorry about that, what I meant is that I get a KeyError. It says that the first_name in REQUEST['first_name'] is not found, when I try to set the variable in line in the script where fname = REQUEST['first_name']. Read the previous responses, you had an error in your html form, have you fixed it? Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas ___ 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] Python Scripts and HTML Forms
If you have a line like in your html file then if you try the following in your script file print REQUEST['first_name'] return printed you should see "default value" printed out you can try: print REQUEST to see the entire contents of REQUEST (very informative) Note: if you do not have a default value in your statement and you do not enter anything in the input field when the form is displayed, then when the form is submitted REQUEST will not contain an entry for the corresponding form field (an entry is made in REQUEST only when data is entered in the form field) Jonathan - Original Message - From: Muk Yan To: Jonathan Cc: zope@zope.org Sent: Thursday, August 17, 2006 4:40 PM Subject: Re: [Zope] Python Scripts and HTML Forms Hey All,Sorry about that, what I meant is that I get a KeyError. It says that the first_name in REQUEST['first_name'] is not found, when I try to set the variable in line in the script where fname = REQUEST['first_name'].Thanks in advance.Cheers,Muk On 8/17/06, Jonathan < [EMAIL PROTECTED]> wrote: What does "it doesn't seem to work" mean? Error messages/traceback? What does your form & script contain? More info on the problem is definitely required! Jonathan - Original Message - From: Muk Yan To: Jonathan ; zope@zope.org Sent: Thursday, August 17, 2006 4:20 PM Subject: Re: [Zope] Python Scripts and HTML Forms Hey Jonathan, All,Thanks I tried your solution, but it doesn't seem to work. Can anybody shed some more light on this situation, since what Jonathan provides is exactly what I want to do, but it's not working.Am I forgetting to put parameteres or some other newbie mistake like that?Thanks in advance and thanks again Jonathan.-Muk On 8/17/06, Jonathan <[EMAIL PROTECTED]> wrote: Form variables are stored in REQUEST. In a python script you gain access to REQUEST by: REQUEST = container.REQUEST you can then access the form variables by: fname = REQUEST['first_name'] you can check for the presence of a form variable by if REQUEST.has_key('first_name'): or if REQUEST.get('first_name', None): hth Jonathan - Original Message - From: Muk Yan To: zope@zope.org Sent: Thursday, August 17, 2006 2:57 PM Subject: [Zope] Python Scripts and HTML Forms Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___Zope maillist - Zope@zope.orghttp://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 )
Re: [Zope] Python Scripts and HTML Forms
Hey All,Sorry about that, what I meant is that I get a KeyError. It says that the first_name in REQUEST['first_name'] is not found, when I try to set the variable in line in the script where fname = REQUEST['first_name'].Thanks in advance.Cheers,MukOn 8/17/06, Jonathan < [EMAIL PROTECTED]> wrote: What does "it doesn't seem to work" mean? Error messages/traceback? What does your form & script contain? More info on the problem is definitely required! Jonathan - Original Message - From: Muk Yan To: Jonathan ; zope@zope.org Sent: Thursday, August 17, 2006 4:20 PM Subject: Re: [Zope] Python Scripts and HTML Forms Hey Jonathan, All,Thanks I tried your solution, but it doesn't seem to work. Can anybody shed some more light on this situation, since what Jonathan provides is exactly what I want to do, but it's not working.Am I forgetting to put parameteres or some other newbie mistake like that?Thanks in advance and thanks again Jonathan.-Muk On 8/17/06, Jonathan <[EMAIL PROTECTED]> wrote: Form variables are stored in REQUEST. In a python script you gain access to REQUEST by: REQUEST = container.REQUEST you can then access the form variables by: fname = REQUEST['first_name'] you can check for the presence of a form variable by if REQUEST.has_key('first_name'): or if REQUEST.get('first_name', None): hth Jonathan - Original Message - From: Muk Yan To: zope@zope.org Sent: Thursday, August 17, 2006 2:57 PM Subject: [Zope] Python Scripts and HTML Forms Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___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 )
Re: [Zope] Python Scripts and HTML Forms
What does "it doesn't seem to work" mean? Error messages/traceback? What does your form & script contain? More info on the problem is definitely required! Jonathan - Original Message - From: Muk Yan To: Jonathan ; zope@zope.org Sent: Thursday, August 17, 2006 4:20 PM Subject: Re: [Zope] Python Scripts and HTML Forms Hey Jonathan, All,Thanks I tried your solution, but it doesn't seem to work. Can anybody shed some more light on this situation, since what Jonathan provides is exactly what I want to do, but it's not working.Am I forgetting to put parameteres or some other newbie mistake like that?Thanks in advance and thanks again Jonathan.-Muk On 8/17/06, Jonathan <[EMAIL PROTECTED]> wrote: Form variables are stored in REQUEST. In a python script you gain access to REQUEST by: REQUEST = container.REQUEST you can then access the form variables by: fname = REQUEST['first_name'] you can check for the presence of a form variable by if REQUEST.has_key('first_name'): or if REQUEST.get('first_name', None): hth Jonathan - Original Message - From: Muk Yan To: zope@zope.org Sent: Thursday, August 17, 2006 2:57 PM Subject: [Zope] Python Scripts and HTML Forms Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___Zope maillist - Zope@zope.orghttp://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 )
Re: [Zope] Python Scripts and HTML Forms
Hey Jonathan, All, Thanks I tried your solution, but it doesn't seem to work. Can anybody shed some more light on this situation, since what Jonathan provides is exactly what I want to do, but it's not working. Am I forgetting to put parameteres or some other newbie mistake like that? Thanks in advance and thanks again Jonathan. -MukOn 8/17/06, Jonathan <[EMAIL PROTECTED]> wrote: Form variables are stored in REQUEST. In a python script you gain access to REQUEST by: REQUEST = container.REQUEST you can then access the form variables by: fname = REQUEST['first_name'] you can check for the presence of a form variable by if REQUEST.has_key('first_name'): or if REQUEST.get('first_name', None): hth Jonathan - Original Message - From: Muk Yan To: zope@zope.org Sent: Thursday, August 17, 2006 2:57 PM Subject: [Zope] Python Scripts and HTML Forms Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___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 )
Re: [Zope] Python Scripts and HTML Forms
Form variables are stored in REQUEST. In a python script you gain access to REQUEST by: REQUEST = container.REQUEST you can then access the form variables by: fname = REQUEST['first_name'] you can check for the presence of a form variable by if REQUEST.has_key('first_name'): or if REQUEST.get('first_name', None): hth Jonathan - Original Message - From: Muk Yan To: zope@zope.org Sent: Thursday, August 17, 2006 2:57 PM Subject: [Zope] Python Scripts and HTML Forms Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___Zope maillist - Zope@zope.orghttp://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 )
Re: [Zope] Python Scripts and HTML Forms
On Thursday 17 August 2006 2:02 pm, Jens Vagelpohl wrote: > request.get(MY_VARIABLE) ??? The one major problem with that is that it ties you to getting information from the request. Better to write a script with explicit parameters and call it with those parameters. Then, you can pull values from a database, another Zope object, or anything else. Also makes testing *much* easier (since you can use the "Test" tab to experiment with it). -- Kirk Strauser The Day Companies ___ 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] Python Scripts and HTML Forms
On Thursday 17 August 2006 1:57 pm, Muk Yan wrote: > Name: Make that: > DTML Method, process_this_form: > > > > and in the Python Script, this_is_a_python_script > I use REQUEST.SESSION.get('firstName') Make that: -- Kirk Strauser The Day Companies ___ 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] Python Scripts and HTML Forms
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 17 Aug 2006, at 14:57, Muk Yan wrote: What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the first_name)> and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance. request.get(MY_VARIABLE) ??? jens -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (Darwin) iD8DBQFE5L1nRAx5nvEhZLIRAndPAKCBH00iBFg9n8b9xkAUSAFQzE2v4ACfZEgv p7G0/4MUGqY8PX3qlThev/U= =8RqC -END PGP SIGNATURE- ___ 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] Python Scripts and HTML Forms
Dear Trusted Zope Zealots,This subject was a bit too broad to do a google search on, because I've tried and the lack of relevancy was astounding.I've probably been committing a cardinal sin in DTML, but I couldn't figure any other work around. I have an HTML form in a DTML Document say:Name: I want to use "first_name" in a python script, but what I've been doing is setting it in the process_this_form, which is a DTML method:DTML Method, process_this_form:and in the Python Script, this_is_a_python_scriptI use REQUEST.SESSION.get('firstName')What my question is, is there anyway to directly access "first_name" from the form in the python script without having to have to call the and then REQUEST.SESSION.get('firstName') in the python script. Sort of a sophomoric question, but any help would be appreciated. Thanks in advance.-Muk ___ 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 )