[Twisted-Python] Nevow question

Matt Goodall matt at pollenation.net
Tue Aug 17 15:41:15 MDT 2004


On Sat, 2004-08-14 at 13:16 +0200, Heiko Wundram wrote:
> Hi all!
> 
> I'm currently working on a web-application with twisted and nevow, and I'm 
> using the SessionWrapper of nevow to enable logins. Well, here comes the 
> catch: When a login fails, nevow redirects to the original page, with a 
> parameter "login-failed=<somestring>", and I'd like to catch this parameter 
> (rather, check if it is there, if it is, output a different string from the 
> template). For this I have created two sections in the HTML template, both 
> using nevow:render="<somefunction>", and for one of these, I return "", and 
> for the other just context.
> 
> But, the problem remains: how can I get the POST/GET parameters (without using 
> something like Formless) that were posted to the page that is being 
> displayed?

Use "msg = context.arg('login-failed')" in your render method to get the
error message or None.

Note: context.arg is a convenience method for getting parameters from
the request. The above is equivalent to "msg = context.locate
(IRequest).args.get('login-failed',[None])[0]".

Cheers, Matt

-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.





More information about the Twisted-Python mailing list