[mod_python] How to pass values

Graham Dumpleton grahamd at dscpl.com.au
Fri Jan 26 04:15:30 EST 2007


Your input filter can't have been called then, or not the part where you
assigned the attribute. If the variable may not be there in all  
situations,
then use:

   if hasattr(req, 'myflag'):
     if req.myflag:
       ..

Graham

On 26/01/2007, at 7:09 PM, export at hope.cz wrote:

> Graham ,
> Thank you for your reply and help.
> I tried the way you suggested but I received the error
>
> AttributeError: 'mp_request' object has no attribute 'myflag'
>
> Can you please help?
> Thank you
> Lad.
>
>
> >
> > On 26/01/2007, at 2:45 AM, export at hope.cz wrote:
> >
> > > Depending on a value being calculated in input filter,
> > > I will have to  make a decission in request handler.
> > > What is a  way to find out  the value of the variable  from input
> > > filter in request handler?
> >
> > I believe this was mentioned before.
> >
> > In filter, set an attribute on the request object:
> >
> >    def inputfilter(filter):
> >      ...
> >      filter.req.myflag = True
> >      ...
> >
> > In the request handler, you can then access that variable.
> >
> >    def handler(req):
> >      ...
> >      if req.myflag:
> >         ...
> >      ...
> >
> > Graham
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070126/61e0bc59/attachment.html


More information about the Mod_python mailing list