Publisher bug in 3.2 BETA.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > Publisher bug in 3.2 BETA.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Publisher bug in 3.2 BETA.  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-05 12:45 PM

In 3.2 beta, if one uses:

SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On

and you DO NOT have an index.py file and use a URL where the first
URL component doesn't map explicitly to a .py file, you will get
a Python error rather than a 404 NOT FOUND response. For example,
for URL "http://localhost:8080/~grahamd/mp32/index", I get:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/apache.py", line 299, in
HandlerDispatch
result = object(req)

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/publisher.py", line 192, in handler
module = page_cache[req]

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/cache.py", line 77, in __getitem__
return self._checkitem(name)[2]

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/cache.py", line 118, in _checkitem
opened = self.check(key, name, entry)

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/publisher.py", line 67, in check
return ModuleCache.check(self, key, req, entry)

File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/cache.py", line 249, in check
opened = file(key, self.mode)

IOError: [Errno 2] No such file or directory:
'/Users/grahamd/Sites/mp32/index.py'







[ Post a follow-up to this message ]



    Re: Publisher bug in 3.2 BETA.  
Jim Gallacher


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-26-05 10:46 PM

I was hoping there would be a simple fix for this but a quick glance at
the code makes me think that will not be the case. Also, I don't think
this is a new bug as 3.1.4 does not generate a 404 NOT FOUND response
either:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)

File "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line
98, in handler
path=[path])

File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
454, in import_module
f, p, d = imp.find_module(parts[i], path)

ImportError: No module named index

We should create a new JIRA issue. If it turns out that the fix is not
easy, is this a big enough problem to hold up the 3.2 release?

Regards,
Jim


Graham Dumpleton wrote:
> In 3.2 beta, if one uses:
>
>   SetHandler mod_python
>   PythonHandler mod_python.publisher
>   PythonDebug On
>
> and you DO NOT have an index.py file and use a URL where the first
> URL component doesn't map explicitly to a .py file, you will get
> a Python error rather than a 404 NOT FOUND response. For example,
> for URL "http://localhost:8080/~grahamd/mp32/index", I get:
>
> Mod_python error: "PythonHandler mod_python.publisher"
>
> Traceback (most recent call last):
>
>   File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/mod_python/apache.py", line 299, in
> HandlerDispatch
>     result = object(req)
>
>   File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/mod_python/publisher.py", line 192, in handler
>     module = page_cache[req]
>
>   File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/mod_python/cache.py", line 77, in __getitem__
>     return self._checkitem(name)[2]
>
>   File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/mod_python/cache.py", line 118, in _checkitem
>     opened = self.check(key, name, entry)
>
>   File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/mod_python/publisher.py", line 67, in check
>     return ModuleCache.check(self, key, req, entry)
>
>   File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> python2.3/site-packages/mod_python/cache.py", line 249, in check
>     opened = file(key, self.mode)
>
> IOError: [Errno 2] No such file or directory:
> '/Users/grahamd/Sites/mp32/index.py'
>







[ Post a follow-up to this message ]



    Re: Publisher bug in 3.2 BETA.  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-27-05 12:46 PM

Unless I am missing something, the fix is quite trivial as it specially
affects just the case where "index.py" is explicitly added to
req.filename
within the publisher code.

Index: lib/python/mod_python/publisher.py
 ========================================
===========================
--- lib/python/mod_python/publisher.py  (revision 240397)
+++ lib/python/mod_python/publisher.py  (working copy)
@@ -166,6 +166,9 @@
# we'll just insert the module name index.py in the middle
path, func_path = split(req.filename)
req.filename = join(path, 'index.py')
+
+            if not exists(req.filename):
+                raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND

# I don't know if it's still possible to have a path_info
# but if we have one, we append it to the filename which



On 27/08/2005, at 12:37 AM, Jim Gallacher wrote:
[vbcol=seagreen]
> I was hoping there would be a simple fix for this but a quick glance
> at the code makes me think that will not be the case. Also, I don't
> think this is a new bug as 3.1.4 does not generate a 404 NOT FOUND
> response either:
>
> Mod_python error: "PythonHandler mod_python.publisher"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
> 299, in HandlerDispatch
>     result = object(req)
>
>   File "/usr/lib/python2.3/site-packages/mod_python/publisher.py",
> line 98, in handler
>     path=[path])
>
>   File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
> 454, in import_module
>     f, p, d = imp.find_module(parts[i], path)
>
> ImportError: No module named index
>
> We should create a new JIRA issue. If it turns out that the fix is not
> easy, is this a big enough problem to hold up the 3.2 release?
>
> Regards,
> Jim
>
>
> Graham Dumpleton wrote: 







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:34 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register