durusmail: quixote-users: can a _q_lookup return a redirect?
can a _q_lookup return a redirect?
2004-11-11
2004-11-11
2004-11-11
2004-11-11
2004-11-11
code and doc
2004-11-11
2004-11-11
2004-11-11
2004-11-11
2004-11-12
2004-11-13
2004-11-11
OT: code and doc
2004-11-11
2004-11-11
2004-12-03
2004-12-03
2004-12-03
can a _q_lookup return a redirect?
Mario Ruggier
2004-11-11
Hi,

I'd like that, from any given page, to be able to have the user click
something and process the request (setting stuff in the session or
cookies or whatever) and then return the user to the calling page. What
I tried to do is to use _q_loopup, and then redirect to the referrer
page, but this systematically gives me a traversal error. Specifically,
for a page given by

http://example.com/path/somepage

the user may click on the link:

http://example.com/path/processor/value

that will therefore call "processor", that will do something with
"value", and then return the user to somepage. The specific code that
is generating a TraversalError is below, where ProcessorUI() is what
"processor" is being mapped to. The print statement is correctly
executed, and the component is actaully "value". However, the redirect
gives a TraversalError with (???) as description.

class ProcessorUI:
     _q_exports=[]
     def _q_lookup(self, request, component):
         # ... do something with component ...
         print component, request.get_url(),
request.get_header('HTTP_REFERER')
         request.redirect(request.get_header('HTTP_REFERER') or '/path/'
)

Cheers, mario


reply