General guidelines
- Make it secure
- Don't expose all your private data members and methods to the world. Prefix everything needed with the underscore '_'
1 _tags = (1,2,3,4) 2 3 def _foo(a,b): 4 return a+b 5 6 def handler(req): 7 return _foo(req['a'], req['b'])
This way, only the handler is accessible from a URL. Both _tags and _foo are hidden.
- Common coding conventions
- Easier to discuss problems when we all "read" the same.
Session specific guidelines
- Let the installation of mod_python decide on the default session manager for you
- Its usually the best decision This allows your code to be more portable by being independent of the data backing store.
1 from mod_python import Session 2 ... 3 req.session = Session.Session(req)
- Its usually the best decision This allows your code to be more portable by being independent of the data backing store.
- Store your session object back in the ''req'' object.