Re: [jira] Commented: (MODPYTHON-98) wrong handler supplied to req.add_handler()generates error

2006-01-12 Thread Jim Gallacher
It's a strange one. When I move site-packages/PIL to 
site-packages/PIL.bak (leaving PIL.pth as is) and run the tests I get 
the same output as Graham and Nicolas. I'm just going to ignore this for 
the time being and go with a refactored unit test.


Jim

Graham Dumpleton wrote:

FWIW, I use Python 2.3 on Mac OS X. Nicolas is probably using Win32
as usual.

I mention this as I wouldn't be surprised if different versions of Python
on different platforms behaved differently when given strange module
names for importing.

Take as an example prior case where someone was using "a/b" for a
module name. Ie., directory name, slash, and then module name. This
wouldn't work on Mac OS X but did work on Linux. Result was that it
allowed loading of a module in a subdirectory without need for use of
packages. Not sure what Win32 did.

Graham

Jim Gallacher wrote ..


Ok, this is weird. I've run the tests on a couple of my qemu images and
I get the same output as Nicolas and Graham in the error log, but a 
different output for my development machine. I think I'll rewrite the 
test to just check the response from the request rather than rooting 
around in the error_log. The point of the test is to make sure that an
exception is raised when req.add_handler("PythonHandler", "") is 
attempted, so there a couple of different ways to go.


I'll make the change and then roll the new beta tarball.

Jim


Nicolas Lehuen wrote:


Hi all,

I'm back after a few days without Internet access...

I also have the same test failure as Graham. Here is my error log :

[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1]
req_add_empty_handler_string
[Thu Jan 12 20:11:24 2006] [notice] mod_python: (Re)importing module


''


[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler :
Traceback (most recent call last):
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler :
File "E:\\Python24\\Lib\\site-packages\\mod_python\\apache.py", line
287, in HandlerDispatch\nlog=debug)
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler :
File "E:\\Python24\\Lib\\site-packages\\mod_python\\apache.py", line
461, in import_module\nf, p, d = imp.find_module(parts[i], path)
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler :
ImportError: No module named
[Thu Jan 12 20:11:25 2006] [notice] mod_python: (Re)importing module


'tests'


[Thu Jan 12 20:11:25 2006] [error] [client 127.0.0.1]
accesshandler_add_handler_to_empty_hl

Regards,
Nicolas
2006/1/12, Jim Gallacher <[EMAIL PROTECTED]>:



Graham Dumpleton wrote:



On 12/01/2006, at 11:10 AM, Jim Gallacher wrote:




Jim Gallacher (JIRA) wrote:




  [  http://issues.apache.org/jira/browse/MODPYTHON-98?
page=comments#action_12362399 ] Jim Gallacher commented on
MODPYTHON-98:

Applied Graham's suggestions so all these related issues can be
considered fixed.
Still need to write some unit tests before this issue is marked as
resolved.



Graham,

I've committed the following unit tests for MODPYTHON-98:

test_req_add_bad_handler
test_req_add_empty_handler_string
test_accesshandler_add_handler_to_empty_hl

Can you take a look and let me know if you think these properly cover
the issue? If they look ok I'll roll the 3.2.6 beta.



I get a failure on test_req_add_empty_handler_string. I don't know if
this is because of other local hacks I have in place or not. But for


it


to pass I need the following change to the test.py:


This test was of some concern, as I thought the error log message might
be inconsistent.




Index: test.py
===
--- test.py (revision 368329)
+++ test.py (working copy)
@@ -516,8 +516,8 @@
   f = open(os.path.join(SERVER_ROOT, "logs/error_log"))
   log = f.read()
   f.close()
-if log.find("contains no 'handler'") == -1:
-self.fail("""Could not find "contains no 'handler'" in
error_log""")
+if log.find("No module named") == -1:
+self.fail("""Could not find "No module named" in
error_log""")

   def test_accesshandler_add_handler_to_empty_hl_conf(self):
   # Note that there is no PythonHandler specified in the the
VirtualHost

The messages in the error log being:

[Thu Jan 12 21:39:35 2006] [notice] mod_python: (Re)importing module


''


[Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler


:


Traceback (most recent call last):
[Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler


:


File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/apache.py", line 284, in
HandlerDispatch\nlog=debug)
[Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler


:


File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/mod_python/apache.py", line 468, in
import_module\nf, p, d = imp.find_module(parts[i], path)
[Thu Jan 12 21:39:35 20

Re: [jira] Commented: (MODPYTHON-98) wrong handler supplied to req.add_handler() generates error

2006-01-12 Thread Nicolas Lehuen
Hi all,

I'm back after a few days without Internet access...

I also have the same test failure as Graham. Here is my error log :

[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1]
req_add_empty_handler_string
[Thu Jan 12 20:11:24 2006] [notice] mod_python: (Re)importing module ''
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler :
Traceback (most recent call last):
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler : 
 File "E:\\Python24\\Lib\\site-packages\\mod_python\\apache.py", line
287, in HandlerDispatch\nlog=debug)
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler : 
 File "E:\\Python24\\Lib\\site-packages\\mod_python\\apache.py", line
461, in import_module\nf, p, d = imp.find_module(parts[i], path)
[Thu Jan 12 20:11:24 2006] [error] [client 127.0.0.1] PythonHandler :
ImportError: No module named
[Thu Jan 12 20:11:25 2006] [notice] mod_python: (Re)importing module 'tests'
[Thu Jan 12 20:11:25 2006] [error] [client 127.0.0.1]
accesshandler_add_handler_to_empty_hl

Regards,
Nicolas
2006/1/12, Jim Gallacher <[EMAIL PROTECTED]>:
> Graham Dumpleton wrote:
> >
> > On 12/01/2006, at 11:10 AM, Jim Gallacher wrote:
> >
> >> Jim Gallacher (JIRA) wrote:
> >>
> >>> [  http://issues.apache.org/jira/browse/MODPYTHON-98?
> >>> page=comments#action_12362399 ] Jim Gallacher commented on
> >>> MODPYTHON-98:
> >>> 
> >>> Applied Graham's suggestions so all these related issues can be
> >>> considered fixed.
> >>> Still need to write some unit tests before this issue is marked as
> >>> resolved.
> >>
> >>
> >> Graham,
> >>
> >> I've committed the following unit tests for MODPYTHON-98:
> >>
> >> test_req_add_bad_handler
> >> test_req_add_empty_handler_string
> >> test_accesshandler_add_handler_to_empty_hl
> >>
> >> Can you take a look and let me know if you think these properly cover
> >> the issue? If they look ok I'll roll the 3.2.6 beta.
> >
> >
> > I get a failure on test_req_add_empty_handler_string. I don't know if
> > this is because of other local hacks I have in place or not. But for it
> > to pass I need the following change to the test.py:
>
> This test was of some concern, as I thought the error log message might
> be inconsistent.
>
> > Index: test.py
> > ===
> > --- test.py (revision 368329)
> > +++ test.py (working copy)
> > @@ -516,8 +516,8 @@
> >  f = open(os.path.join(SERVER_ROOT, "logs/error_log"))
> >  log = f.read()
> >  f.close()
> > -if log.find("contains no 'handler'") == -1:
> > -self.fail("""Could not find "contains no 'handler'" in
> > error_log""")
> > +if log.find("No module named") == -1:
> > +self.fail("""Could not find "No module named" in
> > error_log""")
> >
> >  def test_accesshandler_add_handler_to_empty_hl_conf(self):
> >  # Note that there is no PythonHandler specified in the the
> > VirtualHost
> >
> > The messages in the error log being:
> >
> > [Thu Jan 12 21:39:35 2006] [notice] mod_python: (Re)importing module ''
> > [Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler :
> > Traceback (most recent call last):
> > [Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler :
> > File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> > python2.3/site-packages/mod_python/apache.py", line 284, in
> > HandlerDispatch\nlog=debug)
> > [Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler :
> > File  "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
> > python2.3/site-packages/mod_python/apache.py", line 468, in
> > import_module\nf, p, d = imp.find_module(parts[i], path)
> > [Thu Jan 12 21:39:35 2006] [error] [client 127.0.0.1] PythonHandler :
> > ImportError: No module named
> >
>
> Your error message actually makes more sense, as the last line in my
> error_log for this exception mentions PIL. I have *no* idea where that
> comes from but was hoping that the final line would at least always
> contain the string "contains no 'handler'.
>
> Here is my error_log:
>
> [Thu Jan 12 08:25:13 2006] [error] [client 127.0.0.1]
> req_add_empty_handler_string
> [Thu Jan 12 08:25:13 2006] [notice] mod_python: (Re)importing module ''
> [Thu Jan 12 08:25:13 2006] [error] [client 127.0.0.1] PythonHandler :
> Traceback (most recent call last):
> [Thu Jan 12 08:25:13 2006] [error] [client 127.0.0.1] PythonHandler :
> File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 291,
> in HandlerDispatch\narg=req, silent=hlist.silent)
> [Thu Jan 12 08:25:13 2006] [error] [client 127.0.0.1] PythonHandler :
> File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 531,
> in resolve_object\nraise AttributeError, s
> [Thu Jan 12 08:25:13 2006] [error] [client 127.0.0.1] PythonHandler :
> AttributeError: module
> '/usr/lib/python2.3/site-packages/PIL/__ini