RE: [Zope] How to use RESPONSE.redirect ?
Thanks for the input. -Original Message- From: Curtis Maloney [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 15, 2000 5:59 PM To: Stuart Foster; Zope List Subject: Re: [Zope] How to use RESPONSE.redirect ? On Wed, 16 Aug 2000, Stuart Foster wrote: > I want to use redirect to call another form passing the current form, how > can I do that. > > > > If I do > > The current form isn't being passed ? > If you want to pass the form variables, you're in for a fight. (o8 otherwise, you could simply try : instead of a redirect. If you want to make sure only the correct form vars are passed, you could flub it with something like: If this doesn't help, some more detail on your part might. (o8 > Any ideas.. > > TIA > Stuart > Have a better one, Curtis. ___ 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] How to use RESPONSE.redirect ?
Thanks for the input. I ended up putting the info I needed into the url I put it in a method that is usuble from a couple of forms and it seems to work. Thanks again. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Kapil Thangavelu Sent: Tuesday, August 15, 2000 3:44 PM To: Stuart Foster Cc: Zope List Subject: Re: [Zope] How to use RESPONSE.redirect ? Stuart Foster Wrote: > I want to use redirect to call another form passing the current form, how > can I do that. > > > Hi Stuart, i ran into the same problem a little while ago. i was trying to pass the user around to the proper display&process page(with inputs inplace) after a logic page that determined where they should go based on their inputs. IMO, The crux of the problem is that Zope as a web development platform should include the urlparse lib from the python core more over this problem and others like it should be remedied i believe by a standard method of extending the modules in the _ namespace with thread safe modules that a developer deems nesc. OK enough soap box... i ended up reimplementing the nesc. functionality in a python method and created another method to implement complete form insertion in much the same the style that of some ACS(arsdigita) utiltiy methods do. here they are, usage examples are included in the code. of course this solution requires evan simpson's python methods product be installed on your zope. Cheers Kapil name: url_encode_form_vars args: namespace # depends on url_encode_vars try: vars=namespace['REQUEST'].form method = namespace.getitem('url_encode_vars', 0) return method(vars) except: pass #example call to above # name: url_encode_vars args: ''' Code straight from urllib minor changes to get around assignment to sub_scripts, access to string module, and namepace issues expects a dictionary of key value pairs to be encoded example call ''' global always_safe, quote, quote_plus always_safe = _.string.letters + _.string.digits + '_,.-' def quote(s, safe = '/'): global always_safe safe = always_safe + safe res = [] for c in s: if c not in safe: res.append('%%%02x'%ord(c)) else: res.append(c) return _.string.joinfields(res, '') def quote_plus(s, safe='/'): global quote if ' ' in s: res = [] # replaec ' ' with '+' l = _.string.split(s, ' ') for i in l: res.append(quote(i, safe)) return _.string.join(res, '+') else: return quote(s, safe) def urlencode(dict): global quote_plus l = [] for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) return _.string.join(l, '&') return urlencode(vars) ___ 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] How to use RESPONSE.redirect ?
"R. David Murray" wrote: > > On Tue, 15 Aug 2000, Kapil Thangavelu wrote: > > #example call to above > > # > > If your original form submits using the GET method, then QUERY_STRING > will contain the already URL encoded parameters that the browser > sent originally. True. However, the GET method is of limited utility which is not appropiate for many situations mainly because of size constraints. Examples, file upload, most anything with text area, stuff with a user passwd. Granted the above example is something that is going to stick the whole thing in the URL anyways. But the two python methods can be used for both GETs and POSTs and if you use the second method url_encode_vars you can pass it a dict of only those values you want to receive in the next page example. > DTML also has a url_encode format you can use to cause a string to > be url encoded if it isn't already. Check the dtml reference. been there, done that. DTML fmts are useful only for inserting text into a page or link with a or the entity syntax. there are no functions that will encode a var in a pythonish expression("") which is what you need when doing this with a redirect. Cheers Kapil ___ 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] How to use RESPONSE.redirect ?
On Tue, 15 Aug 2000, Kapil Thangavelu wrote: > #example call to above > # If your original form submits using the GET method, then QUERY_STRING will contain the already URL encoded parameters that the browser sent originally. DTML also has a url_encode format you can use to cause a string to be url encoded if it isn't already. Check the dtml reference. --RDM ___ 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] How to use RESPONSE.redirect ?
Stuart Foster Wrote: > I want to use redirect to call another form passing the current form, how > can I do that. > > > Hi Stuart, i ran into the same problem a little while ago. i was trying to pass the user around to the proper display&process page(with inputs inplace) after a logic page that determined where they should go based on their inputs. IMO, The crux of the problem is that Zope as a web development platform should include the urlparse lib from the python core more over this problem and others like it should be remedied i believe by a standard method of extending the modules in the _ namespace with thread safe modules that a developer deems nesc. OK enough soap box... i ended up reimplementing the nesc. functionality in a python method and created another method to implement complete form insertion in much the same the style that of some ACS(arsdigita) utiltiy methods do. here they are, usage examples are included in the code. of course this solution requires evan simpson's python methods product be installed on your zope. Cheers Kapil name: url_encode_form_vars args: namespace # depends on url_encode_vars try: vars=namespace['REQUEST'].form method = namespace.getitem('url_encode_vars', 0) return method(vars) except: pass #example call to above # name: url_encode_vars args: ''' Code straight from urllib minor changes to get around assignment to sub_scripts, access to string module, and namepace issues expects a dictionary of key value pairs to be encoded example call ''' global always_safe, quote, quote_plus always_safe = _.string.letters + _.string.digits + '_,.-' def quote(s, safe = '/'): global always_safe safe = always_safe + safe res = [] for c in s: if c not in safe: res.append('%%%02x'%ord(c)) else: res.append(c) return _.string.joinfields(res, '') def quote_plus(s, safe='/'): global quote if ' ' in s: res = [] # replaec ' ' with '+' l = _.string.split(s, ' ') for i in l: res.append(quote(i, safe)) return _.string.join(res, '+') else: return quote(s, safe) def urlencode(dict): global quote_plus l = [] for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) return _.string.join(l, '&') return urlencode(vars) ___ 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] How to use RESPONSE.redirect ?
On Wed, 16 Aug 2000, Stuart Foster wrote: > I want to use redirect to call another form passing the current form, how > can I do that. > > > > If I do > > The current form isn't being passed ? > If you want to pass the form variables, you're in for a fight. (o8 otherwise, you could simply try : instead of a redirect. If you want to make sure only the correct form vars are passed, you could flub it with something like: If this doesn't help, some more detail on your part might. (o8 > Any ideas.. > > TIA > Stuart > Have a better one, Curtis. ___ 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] How to use RESPONSE.redirect ?
Should do it! or maybe > > > If I do > > The current form isn't being passed ? > > Any ideas.. > > TIA > Stuart > > > ___ > 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] How to use RESPONSE.redirect ?
HTTP is stateless. You'll have to build the entire query string and put it into your redirect URL. --jfarr - Original Message - From: Stuart Foster <[EMAIL PROTECTED]> To: Zope List <[EMAIL PROTECTED]> Sent: Tuesday, August 15, 2000 10:19 AM Subject: [Zope] How to use RESPONSE.redirect ? > I want to use redirect to call another form passing the current form, how > can I do that. > > > > If I do > > The current form isn't being passed ? > > Any ideas.. > > TIA > Stuart ___ 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] How to use RESPONSE.redirect ?
I want to use redirect to call another form passing the current form, how can I do that. If I do The current form isn't being passed ? Any ideas.. TIA Stuart ___ 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 )