Julien
jcigar at ulb.ac.be
Wed Jun 29 07:48:43 EDT 2005
On Wed, 2005-06-29 at 20:17 +1000, Graham Dumpleton wrote: > On 28/06/2005, at 11:13 PM, Julien wrote: > > As I'm using the publisher handler, my index.py looks like : > > > > import sys > > import os.path > > import neo_cgi > > import neo_util > > import neo_cs > > > > from mod_python import util, apache > > from psycopg import QuotedString > > > > config = apache.import_module('config', autoreload = 0, log = 0) > > utils = apache.import_module('utils', autoreload = 0, log = 0) > > specimen = apache.import_module('specimen', autoreload = 0, log = 0) > > taxon = apache.import_module('taxon', autoreload = 0, log = 0) > > fulltextsearch = apache.import_module('fulltextsearch', autoreload = 0, > > log = 0) > > > > template_directory = config.getTemplateDirectory() > > template_main = config.getTemplateMain() > > template_menu = config.getTemplateMenu() > > > > def index(req): > > return home(req) > > > > def home(req): > > return _render(req, 'home') > > > > def links(req): > > return _render(req, 'links') > > > > def contact(req): > > return _render(req, 'contact') > > > > def taxal(req): > > sort = req.form.getfirst('sort') > > order = req.form.getfirst('order') > > > > tl = taxon.taxon() > > tl.getTaxaList(sort, order) > > hdf = tl.getHDF() > > return _render(req, 'taxalist', hdf) > > > > (...) > > > > So for the above example if I GET http://b.abc.be/birds/taxal it should > > run the "def taxal(req)" function ... I don't understand why I get a > > "mod_python.publisher: ImportError: No module named taxal" error > > message > > in the apache logfile. > > Okay, lets try something different. You should be able to use either: > > http://b.abc.be/birds/taxal > > or: > > http://b.abc.be/birds/index/taxal > > Since the first variant doesn't work, try changing all your URLs to use > the second form. Ie., don't rely on mod_python.publisher automatically > inserting "index" into the path to determine the file to load. I suggest > this as there have been some issues with this ability for "index" to be > inserted automatically. See for example: > > http://issues.apache.org/jira/browse/MODPYTHON-23 > http://issues.apache.org/jira/browse/MODPYTHON-24 > > There may be other cases I didn't stumble across. > > Besides that, at this stage all I can suggest is to use the almost drop > in replacement for mod_python.publisher that exists and see if that gets > rid of the problem. Required changes would be a few lines in the Apache > configuration and change away from using "apache.import_module()" to a > replacement function. If you get desperate enough to want to try that > let me know and I'll let you know what to do off list. > > Graham > it seems to work with index.py/taxal in place of /taxal thanks! -- Julien Cigar (jcigar at ulb.ac.be) Belgian Biodiversity Information Facility Université Libre de Bruxelles Campus de la Plaine CP 257 Bâtiment NO, Bureau 4 N4 115C (Niveau 4) Boulevard du Triomphe, entrée ULB 2 B-1050 Bruxelles http://www.bebif.be
|