Re: [Zope-dev] Passing variable across pages
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Babylakshmi Muthusamy wrote: I tried by storing them in session variables. but the sessions get expired quickly. What means quickly? The timeout and the size of the session pool can be configured. So what's the point? - -aj -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQGUBAEBAgAGBQJOedN8AAoJEADcfz7u4AZjsdQLv0T7rMYJFGyEoPI0dAHJrTY7 EXa1NaTVzwTYyF6eCpBbAP8CeknTsIxTZZdwZhRDlg0st1ITG3jDY6wvhtK7sb+1 AS84hDFOptjKyTdEK/Y8OIzxXgSpo2pocgGcY9BJXbu86b3T/pjFPMVEtAMy+4hm bagCIOfSmRsMDgRPT973F2iSFCq7xv2Hf29aUZNnUjXdKS773gus9SEBqLKKXphh 8K5D0x+NvIt/KVxtQS08fhRqY2+jGQ/uAXKjBVW/igP/9Q/jwaIZ+WTJtoFgRL8y waLxq2hYQWWw9eEGGokSGOsoajVWuo9uLVu8ihsyyHTCTgUpk/UPw084hVRTGiCR n28OcXE+mz59YqkyIjl9Aj8QHSwhKv1oxZPDO25bP9dCbQVE4HteqFPFGUtVQC1Q fgoazUWc2AQhoqtKNWTjkpPafo1YzCH9kEoRz1Z3oacLBatlqZ2QoSRLXZMTvXlF rMBD3I/J36ShhkhH1xmJCjNB6Yu5oVo= =GVj0 -END PGP SIGNATURE- attachment: lists.vcf___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Passing variable across pages
On Wed, Sep 21, 2011 at 12:45 PM, Babylakshmi Muthusamy babylakshmim...@gmail.com wrote: Please suggest me a solution for this. Please post your question to the users mailing list at https://mail.zope.org/mailman/listinfo/zope This mailing list is for the development of Zope, not development with Zope. Thanks, Hanno ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Passing variable across pages
Hello Hanno, Please excuse my off-topic post. On Wed, 2011-09-21 at 13:41 +0200, Hanno Schlichting wrote: Please post your question to the users mailing list at https://mail.zope.org/mailman/listinfo/zope This mailing list is for the development of Zope, not development with Zope. As I always cross post to both zope-dev@zope.org and bluebr...@zope.org for my doubts pertaining to bluebream and ZTK. I was wondering which mailing list that I should stick to for the queries related to bluebream and ZTK. Moreover I see not so active zope3-us...@zope.org mailing list on the net. But as a matter of fact, the solutions that I got for most of my queries were from zope-dev mailing list users. So, it was impossible for me to let go of this mailing list even though I see the no cross posts tag in the mail. After seeing this mail, I've started to think whether I should stop cross posting in my future mails and which mailing list should I single out. Please advice. Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Passing variable across pages
Am 21.09.2011, 16:24 Uhr, schrieb Joshua Immanuel j...@hipro.co.in: After seeing this mail, I've started to think whether I should stop cross posting in my future mails and which mailing list should I single out. Please advice. Dear Joshua, cross-posting is generally unwelcome on any mailing list except for the purpose of announcements. While this list is primarily about the development of Zope, polite requests about real world applications are generally accepted assuming they are related to Zope or the ZTK. However, simply asking I have this problem, how do I solve it questions, and Bablyak's definitely fall into this category, are not in the spirit of the list. Charlie -- Charlie Clark Managing Director Clark Consulting Research German Office Helmholtzstr. 20 Düsseldorf D- 40215 Tel: +49-211-600-3657 Mobile: +49-178-782-6226 ___ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
Re: [Zope] delete a variable from REQUEST
Hi, thanks for ur reply. My problem is, my code is like if REQUEST['usr_msg']: On Mon, Sep 29, 2008 at 1:36 PM, Tino Wildenhain [EMAIL PROTECTED] wrote: Hi, indrajit926 indra wrote: Hi All, Iam relatively new to zope. I want to delete a variable and it value from REQUEST.I used python pop() and __delattr__() ,but getting attribute error. Actually you can't. (Not without writing a product in filesystem and getting deep into zope). Why would you? What you could do is to update one of the requests namespace to give the variable a new value. Regards Tino ___ 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] delete a variable from REQUEST
Hi, thanks for ur reply. My problem is, my code is like #code code code if REQUEST['usr_msg']: do some operations. #some code related to project my program control loops with above if condition. REQUEST is in same context. so once REQUEST stores 'usr_msg ' every time when it goes to if condition , it performs that do some operations Due to above reason i want to delete that usr_msg variable from REQUEST also i cannot put restriction on usr_msg ,because it comes from user input, and user can give any text to that variable. thanks, Indrajit. On Mon, Sep 29, 2008 at 1:36 PM, Tino Wildenhain [EMAIL PROTECTED] wrote: Hi, indrajit926 indra wrote: Hi All, Iam relatively new to zope. I want to delete a variable and it value from REQUEST.I used python pop() and __delattr__() ,but getting attribute error. Actually you can't. (Not without writing a product in filesystem and getting deep into zope). Why would you? What you could do is to update one of the requests namespace to give the variable a new value. Regards Tino ___ 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] delete a variable from REQUEST
Just set it to None. if REQUEST['usr_msg']: do_something() REQUEST.set('usr_msg', None) Then, the next time the condition will be false. 2008/9/30 indrajit926 indra [EMAIL PROTECTED]: Hi, thanks for ur reply. My problem is, my code is like #code code code if REQUEST['usr_msg']: do some operations. #some code related to project my program control loops with above if condition. REQUEST is in same context. so once REQUEST stores 'usr_msg ' every time when it goes to if condition , it performs that do some operations Due to above reason i want to delete that usr_msg variable from REQUEST also i cannot put restriction on usr_msg ,because it comes from user input, and user can give any text to that variable. thanks, Indrajit. On Mon, Sep 29, 2008 at 1:36 PM, Tino Wildenhain [EMAIL PROTECTED] wrote: Hi, indrajit926 indra wrote: Hi All, Iam relatively new to zope. I want to delete a variable and it value from REQUEST.I used python pop() and __delattr__() ,but getting attribute error. Actually you can't. (Not without writing a product in filesystem and getting deep into zope). Why would you? What you could do is to update one of the requests namespace to give the variable a new value. Regards Tino ___ 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 ) -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com ___ 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] delete a variable from REQUEST
Hi, indrajit926 indra wrote: Hi, thanks for ur reply. My problem is, my code is like #code code code if REQUEST['usr_msg']: do some operations. #some code related to project my program control loops with above if condition. REQUEST is in same context. so once REQUEST stores 'usr_msg ' every time when it goes to if condition , it performs that do some operations Due to above reason i want to delete that usr_msg variable from REQUEST But if you would really manage to delete this from REQUEST, you would get an exception when trying to use it in the way above. So, see Peters solution to your problem. also i cannot put restriction on usr_msg ,because it comes from user input, and user can give any text to that variable. If thats some kind of filter chain you probably want to change it to some private name space within request as you would be comfortably getting by REQUEST.set('allmystuff',dict()) at the very beginning. You can actually look up form values from REQUEST.form to distinguish between user input and data from your program. If you just ask REQUEST, you get some kind of stacking layers of name spaces where values get looked up. Please see the Zope book (online) for description of the API. Regards Tino thanks, Indrajit. On Mon, Sep 29, 2008 at 1:36 PM, Tino Wildenhain [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, indrajit926 indra wrote: Hi All, Iam relatively new to zope. I want to delete a variable and it value from REQUEST.I used python pop() and __delattr__() ,but getting attribute error. Actually you can't. (Not without writing a product in filesystem and getting deep into zope). Why would you? What you could do is to update one of the requests namespace to give the variable a new value. Regards Tino ___ 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 ) smime.p7s Description: S/MIME Cryptographic 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 )
Re: [Zope] delete a variable from REQUEST
Hi, indrajit926 indra wrote: Hi All, Iam relatively new to zope. I want to delete a variable and it value from REQUEST.I used python pop() and __delattr__() ,but getting attribute error. Actually you can't. (Not without writing a product in filesystem and getting deep into zope). Why would you? What you could do is to update one of the requests namespace to give the variable a new value. Regards Tino smime.p7s Description: S/MIME Cryptographic 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 )
Re: [Zope] Defining a Variable
Victor Subervi wrote at 2008-1-4 10:59 -0400: Thank you both. However, it still doesn't work :( I have replaced getQuote with getQuote(), but to no avail. Other ideas? *Error Type: RuntimeError Error Value: external method could not be called because it is None* You see here how important it is to always provide full problem description. Usually, beside Error Type and Error Value the traceback, too, is very important. The error information above tells you that your problem is not the ?num but your External Method. Unfortunately, the information is not very precise. You need the following background information: When an External Method cannot be loaded (e.g. because its source is not found), then it is represented as None. You get more information, when you visit the External Method in the ZMI and press edit. -- Dieter ___ 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] Defining a Variable
That was too wierd. I deleted the External Varible, then re-added it, and all worked well! Now, I just built this new server and transfered over the Data.fs files. Maybe that was the problem?? Thanks, Victor On Jan 5, 2008 3:11 PM, Dieter Maurer [EMAIL PROTECTED] wrote: Victor Subervi wrote at 2008-1-4 10:59 -0400: Thank you both. However, it still doesn't work :( I have replaced getQuote with getQuote(), but to no avail. Other ideas? *Error Type: RuntimeError Error Value: external method could not be called because it is None* You see here how important it is to always provide full problem description. Usually, beside Error Type and Error Value the traceback, too, is very important. The error information above tells you that your problem is not the ?num but your External Method. Unfortunately, the information is not very precise. You need the following background information: When an External Method cannot be loaded (e.g. because its source is not found), then it is represented as None. You get more information, when you visit the External Method in the ZMI and press edit. -- Dieter ___ 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] Defining a Variable
Thank you both. However, it still doesn't work :( I have replaced getQuote with getQuote(), but to no avail. Other ideas? *Error Type: RuntimeError Error Value: external method could not be called because it is None* *TIA,* *Victor* On Jan 3, 2008 2:26 PM, Dieter Maurer [EMAIL PROTECTED] wrote: Victor Subervi wrote at 2008-1-2 14:44 -0400: ... html body table tr td tal:define=num python:here.scripts.getQuote As Andreas already has pointed out, you probably need getQuote() rather than getQuote (as the name suggests, it is a method not a value). span metal:use-macro=here/en-us/quotes/?num/macros/quote /br / ?var in a path expression means: replace ?var by the value of var. Therefore, if num contains the right value, the above should work. -- Dieter ___ 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] Defining a Variable
On Wed, Jan 02, 2008 at 02:44:24PM -0400, Victor Subervi wrote: Hi; I have this in a page template: html body table tr td tal:define=num python:here.scripts.getQuote span metal:use-macro=here/en-us/quotes/?num/macros/quote /br / div align=center span class=text a href=quotes.pt target=_topbThe quotes/b/a /span /div /td /tr /table /body html Now, I thought that was the correct way to call the variable num (that is, with the question mark: ?num). Apparently, I'm mistaken. I've even tried defining it this way: I didn't see a followup on this post, so I thought I would add my ignorance to the discussion. first, I don't think you can assign a variable name to a python function using tal and then have tal 'call' the function. second, I think what you do want is the get the results of calling getQuote into the variable called 'num', and then use those results elsewhere. I think tal variables can all be first class python objects. If not, any standard python object works -- in other words, a list, tupple, string, dictionary, etc. If you have your own object, it will need to have an iterator method defined for it -- but then, I wouldn't know how to make the new class known to zope. td tal:define=num python:str(11) to make sure that num was properly assigned. What am I missing? Also, if I have a dir called scripts in which getQuote exists, and scirpts is in the path, shouldn't that notation work okay? acquisition will find many things. What does getQuote return though? TIA, Victor ___ 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 ) -- David Bear phone: 602-496-0424 fax:602-496-0955 College of Public Programs/ASU University Center Rm 622 411 N Central Phoenix, AZ 85007-0685 Beware the IP portfolio, everyone will be suspect of trespassing ___ 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] Defining a Variable
Victor Subervi wrote at 2008-1-2 14:44 -0400: ... html body table tr td tal:define=num python:here.scripts.getQuote As Andreas already has pointed out, you probably need getQuote() rather than getQuote (as the name suggests, it is a method not a value). span metal:use-macro=here/en-us/quotes/?num/macros/quote /br / ?var in a path expression means: replace ?var by the value of var. Therefore, if num contains the right value, the above should work. -- Dieter ___ 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] Defining a Variable
--On 2. Januar 2008 14:44:24 -0400 Victor Subervi [EMAIL PROTECTED] wrote: td tal:define=num python:here.scripts.getQuote As in nearly all other programming languages methods are called with parentheses - or? span metal:use-macro=here/en-us/quotes/?num/macros/quote /br / Now, I thought that was the correct way to call the variable num (that is, with the question mark: ?num). Apparently, I'm mistaken. I've even tried defining it this way: Not sure if using the '?' will working within a TALES expression. It will at least work as the last item with an expression. However it will fail in general if 'num' is an integer. -aj pgppLEvqehHSY.pgp Description: 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 )
Re: [Zope] Calling a Variable
Martijn Pieters schrieb: On 3/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: Incorrect, you can only use ? to interpolate variables into a path expression: span tal:define=foo string:bar tal:content=here/?foo/span The above example will look up 'bar' and render it as the content of the span. I notice ZPT gets weirder and weirder... How many syntactic specialities will we add to path expressions? ;) Why not keep it simple? :-) Or make it simpler by removing even tal:define ... Regards Tino ___ 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] Calling a Variable
On 3/9/07, Tino Wildenhain [EMAIL PROTECTED] wrote: I notice ZPT gets weirder and weirder... How many syntactic specialities will we add to path expressions? ;) ?var interpolation have been supported since the first checkin Evan Simpson made nearly 6 years ago, the feature has been a bit underdocumented, but it is not a recent addition.. -- Martijn Pieters ___ 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] Calling a Variable
[EMAIL PROTECTED] wrote: Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: html tal:define=global base_url here/baseURL; template_id string:index; here python:here.restrictedTraverse('s/c/x/root/en-us/Help') redefining 'here' isn't a good idea... a href=?base_url/contactus.pt I think you meant: a href=# tal:attributes=href string:${base_url}/contactus.pt cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Calling a Variable
Tino Wildenhain wrote: I notice ZPT gets weirder and weirder... It's always been that weird ;-) If you want sanity, try Twiddler instead :-) Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Calling a Variable
--On 8. März 2007 12:48:26 -0500 [EMAIL PROTECTED] wrote: Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: How told you that? Please refer to the ZPT documentation in the Zope Book. -aj pgp85HTzxZq8q.pgp Description: 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 )
Re: [Zope] Calling a Variable
On 3/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: Incorrect, you can only use ? to interpolate variables into a path expression: span tal:define=foo string:bar tal:content=here/?foo/span The above example will look up 'bar' and render it as the content of the span. -- Martijn Pieters ___ 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] Calling a Variable
Dnia czwartek, 8 marca 2007 18:48, [EMAIL PROTECTED] napisał: Hi; I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: You messed some things. First go to google.com and look into address bar in your browser. Then enter any value into search box (plz don't ask me what is any value ;) ) and click search. Look into the address bar again. You will see there something like: google.com?variable_name=variable_valueanother_variable_name=another_variable_value etc. google.com is in your case base_url, and things after ? and are variables that are passed to server (in your case Zope) from your browser (via request). html tal:define=global base_url here/baseURL; template_id string:index; here python:here.restrictedTraverse('s/c/x/root/en-us/Help') Do you really want to define a variable named here? a href=?base_url/contactus.pt What you want here is: base_url/contactus.pt?variable=variable_value. To put a variable value into href attribute use tal:attributes=href ... Please tell me what I'm doing wrong. I tried to be a bit more specific that guys in other answers but please do what they suggested to you: read zope book :) Tony -- Jakub Wisniowski ___ 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] Calling a Variable
Thanks for clarifying that! Tony -Original Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: zope@zope.org Sent: Thu, 8 Mar 2007 2:14 PM Subject: Re: [Zope] Calling a Variable On 3/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I thought I could call a variable in a page template by defining it and then putting a ? in front of it in a URL, like this: Incorrect, you can only use ? to interpolate variables into a path expression: span tal:define=foo string:bar tal:content=here/?foo/span The above example will look up 'bar' and render it as the content of the span. -- Martijn Pieters AOL now offers free email to everyone. Find out more about what's free from AOL at AOL.com. ___ 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] dtml-var variable from REQUEST not shown in input tag if it has spaces??
Am Donnerstag, den 04.08.2005, 11:33 +0100 schrieb Thomas Apostolou: Hello everybody, Im using Zope 2.7.0 on Windows XP Pro. I pass some parameters from a form to a DTML method. Inside that method i try to get the parameters with dtml-var sSQL ( sSQL is the name of the submiting form's field). When i just use it as dtml-var sSQL everything is ok. When i use it like : input type=text value=dtml-var sSQL, i get everything until the first space. For example from select * from mytable i get select. Is it something wrong with what i am doing? Yes, you should write HTML when you want HTML ;) This means, attribute values in HTML are supposed to be in (See the HTML source in your Browser when you display the page and you will know what I mean :) So, if you really want DTML here, use: input type=text value=dtml-var sSQL / or input type=text value=dtml-sSQL; / which is a bit nicer because you dont write a tag inside a tag. OR use ZPT: input type=text tal:attributes=value request/sSQL / ___ 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] dtml-var variable fro m REQUEST not shown in input tag if it has spaces??
--- Tino Wildenhain [EMAIL PROTECTED] έγραψε: Yes, you should write HTML when you want HTML ;) This means, attribute values in HTML are supposed to be in (See the HTML source in your Browser when you display the page and you will know what I mean :) So, if you really want DTML here, use: input type=text value=dtml-var sSQL / or input type=text value=dtml-sSQL; / which is a bit nicer because you dont write a tag inside a tag. OR use ZPT: input type=text tal:attributes=value request/sSQL / was that a realy stupid question or what? 8- Thanks anyway, Thomas Apostolou ___ Χρησιμοποιείτε Yahoo!; Βαρεθήκατε τα ενοχλητικά μηνύματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων http://login.yahoo.com/config/mail?.intl=gr ___ 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] Passing a variable to RESPONSE.redirect
Asad Habib wrote: Is it possible to pass a variable to RESPONSE.redirect or does the page name have to be a literal string? I was unable to pass in a variable via the REQUEST object (i.e. REQUEST.get('pageName')) or the SESSION attribute of the REQUEST object (i.e. REQUEST.SESSION.get('pageName')). Any help would be appreciated. Thanks. How do you mean unable? That's not a very good problem description. RESPONSE.redirect is simply a Python method, and it will take any string you can manage, no matter where it comes from. In fact, I think it would be very difficult to do otherwise. You must, of course, pass the value of a variable, and not the variable itself. None of the following pose any problem:: REQUEST.RESPONSE.redirect(http://plone.org;) url = http://plone.org; REQUEST.RESPONSE.redirect(url) def redir(): return http://plone.org; REQUEST.RESPONSE.redirect(redir()) urls = {} urls['plone'] = http://plone.org; REQUEST.RESPONSE.redirect(urls['plone']) REQUEST.RESPONSE.redirect(urls.get('plone', /)) In fact, they should all work identically. --jcc -- Building Websites with Plone http://plonebook.packtpub.com/ Enfold Systems, LLC http://www.enfoldsystems.com ___ 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] creating variable names by adding 2 strings?
Lee writes: I'm creating variables in python but I am having trouble creating them when they're *named* using other variables. Here's an example; while (p!=0): p+`p`= string.replace(component[control], ",", "") # e.g. I want 'p1 = string.replace.blah...' p=p-1 control=control+1 == SyntaxError: can't assign to operator :( Why do you want to do that? It is really strange, that you want computed variable names in local namespaces. If you want them in an object, class or module, you could use "setattr". If it should go into the current module, you could use "globals()[name_expr]=value" (though the Python spec says, this may change in future implementations). Note, that security restrictions may prevent you from using "setattr" in Python scripts. Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] [python] creating variable names by adding 2 strings?
Hi Lee, You could use a dictionary for this: vars = {} while (p!=0): vars['p'+`p`] = string.replace(component[control], ",", "") p=p-1 control=control+1 then 'vars' will contain keys (e.g., 'p1', 'p2' etc.. ) and corresponding values. If that's totally not what you want.. a little more context would help. ;-) -steve -- Hi there, I'm creating variables in python but I am having trouble creating them when they're *named* using other variables. Here's an example; while (p!=0): p+`p`= string.replace(component[control], ",", "") # e.g. I want 'p1 = string.replace.blah...' p=p-1 control=control+1 == SyntaxError: can't assign to operator :( I've tried various things but I cannot find a solution. I've got a nasty feeling that it's not possible... If someone could confirm this or hopefully, tell me how to do it I would be_extremely_grateful. Thanks, Lee (crossing his fingers) ___ Zope maillist - [EMAIL PROTECTED] 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 ) ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Putting a variable in a redirect call
Please dont post in html BTW. -- Andy McKay. - Original Message - From: "Yvonne Totty" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 3:11 PM Subject: [Zope] Putting a variable in a redirect call All, I need to replace the URL below to a partial dtml-var and and an address, like so: dtml-call "RESPONSE.redirect('https://www.mysite.com/scripts/zope.pcgi/Anywhere/COMTem p/'+LUserOut+' .doc')" to: dtml-call "RESPONSE.redirect('dtml-var baserefW/COMTemp...blah, blah)" where baserefW contains the information replaced in the second sentence to make the address easily changeable site-wide. How can I acheive this? TIA, -y ~~~ Yvonne Totty Database Engineer, x2198 - Maximus: What we do in life, echoes in eternity. -- Gladiator ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Putting a variable in a redirect call
Exactly as per your first example: dtml-call "RESPONSE.redirect(baserefW + '/COMTemp')" -- Andy McKay. - Original Message - From: "Yvonne Totty" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 3:11 PM Subject: [Zope] Putting a variable in a redirect call All, I need to replace the URL below to a partial dtml-var and and an address, like so: dtml-call "RESPONSE.redirect('https://www.mysite.com/scripts/zope.pcgi/Anywhere/COMTem p/'+LUserOut+' .doc')" to: dtml-call "RESPONSE.redirect('dtml-var baserefW/COMTemp...blah, blah)" where baserefW contains the information replaced in the second sentence to make the address easily changeable site-wide. How can I acheive this? TIA, -y ~~~ Yvonne Totty Database Engineer, x2198 - Maximus: What we do in life, echoes in eternity. -- Gladiator ___ Zope maillist - [EMAIL PROTECTED] 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 )
RE: [Zope] Putting a variable in a redirect call
Gosh darn it, it didn't work 8( ~~~ Yvonne Totty Database Engineer, x2198 - Maximus: What we do in life, echoes in eternity. -- Gladiator Exactly as per your first example: dtml-call "RESPONSE.redirect(baserefW + '/COMTemp')" -- Andy McKay. - Original Message - From: "Yvonne Totty" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 3:11 PM Subject: [Zope] Putting a variable in a redirect call All, I need to replace the URL below to a partial dtml-var and and an address, like so: dtml-call "RESPONSE.redirect('https://www.mysite.com/scripts/zope.pcgi/Anywh ere/COMTem p/'+LUserOut+' .doc')" to: dtml-call "RESPONSE.redirect('dtml-var baserefW/COMTemp...blah, blah)" where baserefW contains the information replaced in the second sentence to make the address easily changeable site-wide. How can I acheive this? TIA, -y ~~~ Yvonne Totty Database Engineer, x2198 - Maximus: What we do in life, echoes in eternity. -- Gladiator ___ Zope maillist - [EMAIL PROTECTED] 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 )
RE: [Zope] Putting a variable in a redirect call
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Yvonne Totty I need to replace the URL below to a partial dtml-var and and an address, like so: dtml-call "RESPONSE.redirect ('https://www.mysite.com/scripts/zope.pcgi/Anywhere/COMTemp/'+LUserOut+'.do c')" to: dtml-call "RESPONSE.redirect('dtml-var baserefW/COMTemp...blah, blah)" Actually you are allmost doing it right yourself: dtml-call "RESPONSE.redirect(baserefW + '/COMTemp' + LUserOut + '.doc')" Regards MaxM ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] Putting a variable in a redirect call
Whats the error? -- Andy McKay. - Original Message - From: "Yvonne Totty" [EMAIL PROTECTED] To: "Andy McKay" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 3:57 PM Subject: RE: [Zope] Putting a variable in a redirect call Gosh darn it, it didn't work 8( ~~~ Yvonne Totty Database Engineer, x2198 - Maximus: What we do in life, echoes in eternity. -- Gladiator Exactly as per your first example: dtml-call "RESPONSE.redirect(baserefW + '/COMTemp')" -- Andy McKay. - Original Message - From: "Yvonne Totty" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 17, 2001 3:11 PM Subject: [Zope] Putting a variable in a redirect call All, I need to replace the URL below to a partial dtml-var and and an address, like so: dtml-call "RESPONSE.redirect('https://www.mysite.com/scripts/zope.pcgi/Anywh ere/COMTem p/'+LUserOut+' .doc')" to: dtml-call "RESPONSE.redirect('dtml-var baserefW/COMTemp...blah, blah)" where baserefW contains the information replaced in the second sentence to make the address easily changeable site-wide. How can I acheive this? TIA, -y ~~~ Yvonne Totty Database Engineer, x2198 - Maximus: What we do in life, echoes in eternity. -- Gladiator ___ Zope maillist - [EMAIL PROTECTED] 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 )
RE: [Zope] with a variable
// I want to get some properties for a zclass instance after being // passed its // id in a variable. In these tests I have been defining the varible in the // code, in the final case it will be passed through the url. // // Using the id directly as above works fine, it writes the // attribute to the // page. // // Thanks for any help, // // Josh On Hi Josh, I'm kinda new to this stuff, but I think I am doing something similar to what you need. I have a DTML method that grabs a ZCLass object's id from the query string and uses it to gain access to that ZCLass object. It looks like I'm generating the id's the same way you are (not that that matters...) I do it like this: The URLs look something like this: addUserToEvent?977952867 where 977952867 is the id of the ZClass object I want to work with and the "addUserToEvent" method has this in it: dtml-with "_.getitem(QUERY_STRING)" ...Do stuff with the ZClass reference here... /dtml-with I hope that helps. Eric. ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] with a variable
I want to read an zclass instances' properties. I want to make some dtml that can be passed the instances' id then give me the properties that I request. I was trying dtml-with and it worked when I plugged the id striaght into it, but when I tried substituting that with a dynamic varible I couldn't get it to work. I have been trying some other approaches that maybe someone could tell me if I am on the right track or if there is some cumentaion that could help me out. I have been going through the list archives for hours! here is a my latest failed attempt! dtml-call "REQUEST.set('userid', 979226100)" dtml-var "_[userid]._getAttribute(hairpart)" I know that I could use the Catalog, but it seems crazy to have to track everyvariable property of an object that I want to access. I am sure that this is a basic problem and would love some help with it. josh on ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] with a variable
thanks Steve and Rick, Unfortunately both your solutions brought up this error: Error Type: SystemError Error Value: bad argument to internal function dtml-call "REQUEST.set('userid', 979226100)" dtml-with "_[userid]" dtml-var attribute /dtml-with or dtml-with "_.getitem(userid)" This works: dtml-with 979226100 dtml-var attribute /dtml-with I want to get some properties for a zclass instance after being passed its id in a variable. In these tests I have been defining the varible in the code, in the final case it will be passed through the url. Using the id directly as above works fine, it writes the attribute to the page. Thanks for any help, Josh On ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] with a variable
I got it to work thanks for the help! dtml-call "REQUEST.set('userid', '979226100')" dtml-with "_[userid]" dtml-var attribute /dtml-with it was the cobination of no quotes around the the userid AND setting the variable as a string not an integer! arrrggghh... thank godness, now I can have lunch. josh on ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] with a variable
josh on writes: dtml-with 979226100 This interprets "979226100" as a name! dtml-var attribute /dtml-with This doesn't: dtml-call "REQUEST.set('userid', 979226100)" This interprets "979226100" as an integer. You could use dtml-call "REQUEST.set('userid', _.getitem('979226100'))" Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] with a variable
How about this: dtml-call "REQUEST.set('userid', 979226100)" dtml-with "_[userid]" dtml-var attribute /dtml-with or dtml-call "REQUEST.set('userid', 979226100)" dtml-with "_.getitem(userid)" dtml-var attribute /dtml-with -steve Hi, a small problem!, This works: dtml-with 979226100 dtml-var attribute /dtml-with This doesn't: dtml-call "REQUEST.set('userid', 979226100)" dtml-with "_.getitem('userid')" dtml-var attribute /dtml-with Nor this: dtml-call "REQUEST.set('userid', 979226100)" dtml-with "userid" dtml-var attribute /dtml-with Nor this: dtml-call "REQUEST.set('userid', 979226100)" dtml-with userid dtml-var attribute /dtml-with What I want to do is have a varible passed to the page which says what zclass instance to get the properties of. any help appreciated. josh on === write: [EMAIL PROTECTED] read: www.futurefarmers.com read: www.crd.rca.ac.co.uk/~josh interrupt (i love it): (415) 552 2124 = ___ Zope maillist - [EMAIL PROTECTED] 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 ) ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] space in variable returned by queries
Vanfleteren Francois wrote: Hello, I'm working with Zope and PostgreSQL When i do a query, Zope returns me a variable with a space at the end Do you know how i can do not to have this space at the end? dtml-var "_.strip(var_with_space_at_the_end)" should do. Or dtml-call "REQUEST.set('var_without_space_at_the_end',_.strip(var_with_space))" HTH Tino Wildenhain ___ Zope maillist - [EMAIL PROTECTED] 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 )