[mod_python] My template script isn't working

Anton selecter at gmail.com
Mon Aug 29 09:05:44 EDT 2005


IT WORKED!

[Mon Aug 29 16:00:48 2005] [notice] mod_python: (Re)importing module
'quote_of_the_day' with path set to
'['/home/anton/homepage/py-homepage/include']'

Thanks a lot! :)
At the same time I have discovered firefox' terrible memory leaks.
Maybe it somehow related to this bug.

2005/8/29, Graham Dumpleton <grahamd at dscpl.com.au>:
> 
> 
> On 29/08/2005, at 10:23 PM, Anton wrote:
> 
> I have read your articles. Well written :)
> I think I know exactly what particular problem I am having
> 
> As it is written here
> http://issues.apache.org/jira/browse/MODPYTHON-7:
> "This means that if one restores an old version of a file from backup,
> eg., by using "mv" command from another location, it will not reload
> it and it is necessary to touch the file or restart Apache."
> 
> I upgraded to mod_python 3.2.0 but anyway bug still persists.
> 'if mtime != oldmtime' is in apache.py though
> 
> Here is how my files are arranged:
> ftp://selecter.no-ip.org/py-homepage/
> Have a play with this instead (untested):
> 
>   from mod_python import apache
>   psp = apache.import_module("mod_python.psp")
>   import os,sys
> 
>   __here__ = os.path.dirname(__file__)
>   __include_dir = os.path.join(__here__,'include')
> 
>   def index(req):
>       quote_of_the_day =
> apache.import_module('quote_of_the_day',log=1,path=[__include_dir])
>       req.content_type = 'text/html'
>       tmpl = psp.PSP(req, filename=os.path.join(__here__,
> 'templates/index.tmpl'))
>       tmpl.run(
> vars={'QUOTE':quote_of_the_day.today_quote()} )
>       return
> 
> By using "import_module()" within the scope of the executing handler, a
> check
> is made on each request as to whether the quote Python code file has changed
> and it will be reloaded if necessary when it does.
> 
> Graham



More information about the Mod_python mailing list