Jorey Bump
list at joreybump.com
Mon Sep 12 16:07:52 EDT 2005
akonsu wrote: > hello, > > i am new to mod_python and python in general, so may be these are very > basic questions, but i still would appreciate your responses: > > 1. if i use the publisher handler, is there any way to hide some > function definitions in my .py file that is invoked through the > publisher handler so that the user could not call these functions by > navigating to their url? An underscore will prevent direct access: def _foo(): ... Or, for variables: _foo = 'bar' Functions in imported modules cannot be accessed directly: import foo bar = foo.bar() This will allow: http://host/test.py/bar But not: http://host/test.py/foo.bar Or: http://host/test.py/foo/bar > 2. in my .py file (that is invoked through the publisher handler > again) i define some global variables. i noticed that these variables > are initialised once. is this by design or just a coincidence? can i > rely on this behaviour? It depends. A database or other persistent storage mechanism may be more reliable.
|