[mod_python] Apache 2.0.39 and publisher

Gerard Patel gerard.patel at nerim.net
Mon Jul 1 23:43:06 EST 2002


First thing first : I'm a rank beginner with Apache *and* Python :-)

I want to learn both and am trying to setup a very small web site
to test.
I am giving mod_python a try, with Apache 2.0.39, mod_python
from CVS, Python 2.2

Hum, a little question : docu states that Python should be compiled
with no threading support, however in the code I see a 
WITH_THREAD flag, is this restriction still valid for current
CVS ? It seems to work, but my testing is somewhat 
limited for now.

Now, the problems :

First problem : mod_python does not compile

fix :

--- requestobject.c.orig        Mon Jun  3 16:31:15 2002
+++ requestobject.c     Sun Jun 30 11:05:05 2002
@@ -743,7 +743,6 @@
     {"bytes_sent",         T_LONG,      OFF(bytes_sent),           RO},
     {"mtime",              T_LONG,      OFF(mtime),                RO},
     {"chunked",            T_INT,       OFF(chunked),              RO},
-    {"boundary",           T_STRING,    OFF(boundary),             RO},
     {"range",              T_STRING,    OFF(range),                RO},
     {"clength",            T_LONG,      OFF(clength),              RO},
     {"remaining",          T_LONG,      OFF(remaining),            RO},

The Apache guys removed this field from the last version I downloaded
(the aborted 2.0.37) and 2.0.39. Strange.

Second problem : the publisher.

I test it with a minimal app that just displays the one field of
my page :

def Bouton1(req, TextField1):

    s = TextField1
    return s

It works fine, but if I reload the form immediately after, it does
not work unless I wait about 15 seconds.

Fix :
--- apache.py.orig      Wed Apr 10 23:24:24 2002
+++ apache.py   Mon Jul  1 23:21:25 2002
@@ -399,8 +399,9 @@

         # but is it in the path?
         file = module.__dict__.get("__file__")
-        if not file or (path and not file in path):
-                raise SERVER_RETURN, HTTP_NOT_FOUND
+       pathfile, filefile = os.path.split(file)
+        if not file or (path and not pathfile in path):
+               raise SERVER_RETURN, HTTP_NOT_FOUND

         if autoreload:
             oldmtime = module.__dict__.get("__mtime__", 0)

I suspect that this is not elegant Python or even correct, 
please remember that I have written a grand total of about 
300 lines of Python so far.

Anyway, with the change it seems to work better at least.

Thanks for your comments, I am ready to try any
better ideas that you want me to test, and sorry
if I have just misconfigured the beast; I have read
the archive a bit and seen something similar
to my second problem, but no solution AFAICT.

Gerard Patel

More information about the Mod_python mailing list