[mod_python] under names

Graham Dumpleton grahamd at dscpl.com.au
Fri Jun 16 21:56:27 EDT 2006

On 17/06/2006, at 3:04 AM, David Bear wrote:

> I know that using an underscore in an identifier 'hides' that name
> from being accessible to a url.

The underscore rule only applies if you are using mod_python.publisher.
It doesn't apply if you are defining your own basic handler or are using

> I am wondering if that applies to
> identifiers that are imported as well.
> For example if,
> from mydefines import *
> makes an identifier mydefines.myvariable available in the namespace as
> 'myvariable', is it still possible to 'call' myvariable via url as in
> http://myserver/pythonapp.py/myvariable
> I am starting to wonder about the best way to keep certain functions
> and variables obaque to prying web eyes, and if putting them in
> modules offers any protection.

When mod_python.publisher is used, any variable, function etc,  
whether it
be local or imported from another module as above is hidden if a leading
underscore is used for the name.

Note that make sure you are using recent version of mod_python (3.2.7+)
though, as 3.1.X has a bug in it that results in underscore prefix  
being visible in a certain error situation.


> -- 
> David Bear
> phone: 	480-965-8257
> fax: 	480-965-9189
> College of Public Programs/ASU
> Wilson Hall 232
> Tempe, AZ 85287-0803
>  "Beware the IP portfolio, everyone will be suspect of trespassing"
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list