R: [mod_python] Serius problem in mod_python-3.2.2b

Nicolas Lehuen nicolas.lehuen at gmail.com
Wed Oct 19 07:43:45 EDT 2005


Yes, you can start using Graham's workaround, as we can't guarantee anything
about the published module names in the future.

Regards,
Nicolas

2005/10/19, Graham Dumpleton <grahamd at dscpl.com.au>:
>
>
> On 19/10/2005, at 8:04 PM, Manera, Villiam wrote:
>
> > Is not a import problem, I have now tried the workaround from Graham
> > Dumpleton:
> >
> > name = os.path.splitext(os.path.split(__file__)[1])[0] instead
> > __name__ and it work fine.
> >
> > I use __name__ inside my appplications not for import scope, but for
> > check autentication of module and so on...
> >
> > I this will be the new behaviour I may fix all my programs (375) that
> > used __name__
> >
> > May I start to fix my programs
> > withos.path.splitext(os.path.split(__file__)[1])[0] instead
> > __name__ ?
>
> You shouldn't really use module name for authentication in this way. The
> reason is that with mod_python.publisher, you could have index.py
> present in two different directories. In 3.2 these will truly be two
> distinct modules albeit they still use the same basename of "index". If
> your authentication is based purely on module name (basename), you
> wouldn't be able to define different authorisation credentials for these
> two different files. You would perhaps be better off basing any
> authentication mechanism on URL or physical file location.
>
> Graham
>
> > -----Messaggio originale-----
> > Da: Nicolas Lehuen [mailto:nicolas.lehuen at gmail.com]
> > Inviato: mercoledì 19 ottobre 2005 11.05
> > A: Manera, Villiam
> > Cc: mod_python at modpython.org
> > Oggetto: Re: [mod_python] Serius problem in mod_python-3.2.2b
> >
> >> No, it's not a bug, it's a feature. In the new publisher, published
> >> module are no longer stored in sys.modules and the __name__ attribute
> >> of the module is based on the filename.
> >>
> >> Why is this a problem to you ? Giving the published module a simpler
> >> name is not that complicated, but I need to understand why it's
> >> important. Especially, if it is because you expect to be able to
> >> import the module by name from another module, tell me because things
> >> will change in the future mod_python releases.
> >>
> >> Regards,
> >> Nicolas
> >>
> >> 2005/10/19, Manera, Villiam <vmanera at manord.com>: I Installed the
> >> beta from mod_python-3.2.2b.win32-py2.4.exe
> >>> Apache has started well
> >>>
> >>> In my login program, the first checked, I use the python variable
> >>> __name__and this is the problem:
> >>>
> >>> In early mod_python version the value was as
> >>> expetded:-->cgi-mpy_login<---Module name
> >>>
> >>> In this beta:-->D_discoE_script_cgi_cgi_mpy_cgi_mpy_login_py
> >>> <---Module
> >>> name
> >>>
> >>>
> >>> Why mod python change the python variable __name__ ?????
> >>>
> >>> I hope this is a bug
> >>>
> >>> Villiam
> >>> Italy
> >>>
> >>> _______________________________________________
> >>> Mod_python mailing list
> >>> Mod_python at modpython.org
> >>> http://mailman.modpython.org/mailman/listinfo/mod_python
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051019/a07af1b8/attachment-0001.html


More information about the Mod_python mailing list