[mod_python] how in include custom module in psp ?

James Yu cyu021 at gmail.com
Sat Jan 19 22:42:41 EST 2008


I just finished working on a skeleton of a web site.
Now I would like to put the codes in common into some functions.
I tried to put the function in a .py file and included the file in <%%>
block, but this doesn't work.

This is the example of how I did it (both test.py and web.psp are in the
same folder):
test.py:
def hello_world():
    return 'hello world'

web.psp:
<%
import test

a = test.hello_world()
%>

This turned out showing me the following msg:

AttributeError: 'module' object has no attribute 'hello_world'


Someone please gives me a hand on importing custom modules in mod_python
PSP.
-- 
This is a UTF-8 formatted mail
-----------------------------------------------
James C.-C.Yu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080120/222d2831/attachment.html


More information about the Mod_python mailing list