[mod_python] publisher handler not working on FreeBSD, Apache 1.3 and modpython 2.7

Graham Dumpleton grahamd at dscpl.com.au
Sat Mar 25 20:34:28 EST 2006


On 26/03/2006, at 8:45 AM, Alberto Ruiz wrote:

> Thanks for replying so quickly.
>
> This is the part that is confusing.  Everything worked fine on a Linux
> Debian system.  So now that I migrated to a FreeBSD system, I have to
> create other functions?  What's different?

Are you sure you were using mod_python before and not just a CGI script
written in Python? They are different things and you do not need
mod_python to write CGI scripts. In CGI scripts you don't need the
functions as script are executed in total each time. Thus, the fact
you didn't have functions before suggests to me you weren't truly
using mod_python before.

Can you post a small but complete self contained example of what you
were using before.

> My main function is labeled
> 'index': Here is a snipet of what I have in propman.py:
>
> from mod_python import Cookie
> def index (req,LLRuser='',LLRpw=''):
> 	global R; R=req; R.content_type="text/html"
> 	cur=DBconnectpropman.DB.cursor()
> ......

This code is poorly written. You should NOT assign a "req" object to
a global variable because if you ever upgrade to Apache 2.0 and use
a multithread Apache MPM then multiple requests could be executing in
index() at the same time and they will interfere with each other. You
should pass the "req" object to other functions if they need to access
it.

> So you are saying that I have to modify my calls to my python scrypts 
> to
> be propman.py/index , instead of just propman.py, right?

It should be sufficient to use "propman.py" even if you were to use
mod_python.publisher as it will fallback to calling "index()".

> The version of modpython in my old system was 2.7.10, so I assumed that
> they weren't that many changes.
> So is there a way to change the call to my scripts so I don't to
> append /index ?

If you have control over this box, I would highly recommend you upgrade
to Apache 2.2 and mod_python 3.2.8.

Graham


> On Sat, 2006-03-25 at 17:10 -0500, Jorey Bump wrote:
>> Alberto Ruiz wrote:
>>> I've looked at the documentation and the faq section but I can't 
>>> figure
>>> out what I'm doing wrong.   The test script works fine as seen below 
>>> in
>>> the first <Directory> directive.  But when I try to use the publisher
>>> handler, I get error not found (404).  If I add 'SetHandler', it 
>>> dumps
>>> the script code.   What am I missing? Or what else can I do to
>>> troubleshoot the issue.  Let me know if I need to post more of the
>>> httpd.conf.
>>>
>>> URLS tried:
>>> http://www.brianheadrentals.com/cgi-bin/test.py
>>> http://www.brianheadrentals.com/propman.py
>>
>> Go back and read the documentation on Publisher (for your version of
>> mod_python). Create a function within the module to use as your 
>> target:
>>
>>   http://www.brianheadrentals.com/propman.py/somefunction
>>
>>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list