Lionel Roubeyrie
lroubeyrie at limair.asso.fr
Mon Jan 31 11:47:37 EST 2005
Le Lundi 31 Janvier 2005 16:42, Jorey Bump a écrit : > > Okay, in order to avoid some the quirks of Publisher, let's give the > module a unique name, like foo.py. Rename the index function to > something else (I'll use "start" as an example). Avoid using the Alias > while you're troubleshooting, and don't set the PythonPath for now. This > gives us an URL like this: > > http://localhost/topdir/webdir/foo/start > > Assuming cartair.py is in /topdir/webdir, it should be imported > properly, because the directory in which mod_python is defined is > prepended to the path (unless PythonPath is set). I use index.py in /topdir/webdir (it's a framed page in which the others pages are also in /topdir/webdir. I can put out the .py because I don't really need it, but I don't find how to mix .html and .py files together (and I don't want to use PSP pages because I need to call others modules). The others .py pages use the publisher with a index(req) method, like menu.py which have to call cartair.py located in /topdir (and not /topdir/webdir!), and this is the problem. One time they can call cartair.py, another time not. > You didn't mention the name of your published module, but it looks like > you're calling it index.py. That's a bad habit you should break. > Although it's offered as a convenience, it creates problems because > newbies treat it like index.html and don't understand that you can only > have one index.py per interpreter, regardless of the location. Published > modules are imported into the root namespace and will cause collisions > if all published module names are not unique. This can cause the erratic > behaviour you describe. Used properly, it can allow you to use a module > as the root of your site, but it's really just smoke and mirrors. To put > it in a somewhat gross oversimplification, Publisher allows you to have > only one index.py in your site. > > > > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python -- Lionel Roubeyrie - lroubeyrie at limair.asso.fr LIMAIR http://www.limair.asso.fr
|