quetz-mod_python-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Mod_python Wiki] Update of "Best programming practices and style guide" by MartinStoufer
Date Tue, 12 Dec 2006 23:54:36 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Mod_python Wiki" for change notification.

The following page has been changed by MartinStoufer:
http://wiki.apache.org/mod_python/Best_programming_practices_and_style_guide

The comment on the change is:
Initial checking. Definetly needs more meet and input.

------------------------------------------------------------------------------
+ == General guidelines ==
+ 
-  * Make it secure
+   Make it secure::
+     Don't expose all your private data members and methods to the world. Prefix everything
needed with the underscore '_'
+   {{{#!python
+   _tags = (1,2,3,4)
+ 
+   def _foo(a,b):
+       return a+b
+ 
+   def handler(req):
+       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.
-  * Deviate when needed
+  
+ == 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.
+    {{{#!python
+    from mod_python import Session
+    ...
+    req.session = Session.Session(req)
+    }}}
+   Store your session object back in the ''req'' object.::
  

Mime
View raw message