[mod_python] Wiki for mod_python. Contributors welcome.

Graham Dumpleton grahamd at dscpl.com.au
Mon Nov 27 23:59:56 EST 2006


Erik Thompson wrote ..
> >
> > > This is a good sentiment.  But, does it make some sense to have a spot
> > > on the
> > > wiki for code devoted to things like this?  Session handling can be
> > > approached many ways, so it might be useful to have code examples hosted
> > > more
> > > formally than simply via the email archive.  Also, one could envision
> a
> > > generic handlers section, a persistent objects section, etc.  All of
> > these
> > > have been discussed relatively recently; wouldn't it be nice to say
> "put
> > > in
> > > on the wiki" or "refer to the wiki" when these come up?
> > >
> >
> >
> I took the liberty of adding a sample code page to the wiki and a PSP
> example I wrote recently when I was attempting to learn the correct syntax
> for using session and form variables.  Feel free to review, modify, delete,
> or whatever =).  I'd personally love to see more examples of PSP and
> mod_python to help myself and others learn.
> 
> http://wiki.apache.org/mod_python/
> http://wiki.apache.org/mod_python/SampleCode
> http://wiki.apache.org/mod_python/GuessingGame

Thanks for getting the ball rolling.

BTW, you do not need to create a Session class instance in a PSP page
explicitly. It is enough to reference the 'session' variable and the underlying
PSP handler will create the Session class instance for you, it being
available through that same 'session' variable.

So, you should be able to delete:

  s = Session.Session(req)

and then instead of using 's', use 'session' instead.

By doing it this way you also avoid the need to have:

  s.save()

as the PSP handler will always save the session it creates when 'session'
variable reference triggers its creation.

You might like to give those changes a go and if it all works okay put up the
modified version.

Thanks again.

Graham


More information about the Mod_python mailing list