[mod_python] error in mod_python.apache.resolve_object

Oliver Graf ograf at rz-online.net
Mon Jan 5 12:19:12 EST 2004

[already send this to python-dev at httpd.apache.org, but got nothing


The resolve_object method does not work with class instances.

The error is simple: in line 551 there is a if

        if silent and not hasattr(module, obj_str):
            return None

this checks always module for obj_str. But it should check the current
obj in traversal!

So correct would be:

        if silent and not hasattr(obj, obj_str):
            return None


-------------- next part --------------
--- mod_python-3.1.2b/lib/python/mod_python/apache.py.orig	2004-01-05 11:16:44.000000000 +0100
+++ mod_python-3.1.2b/lib/python/mod_python/apache.py	2004-01-05 11:16:53.000000000 +0100
@@ -552,7 +552,7 @@
             return None
         # this adds a little clarity if we have an attriute error
-        if obj == module and not hasattr(module, obj_str):
+        if obj == module and not hasattr(obj, obj_str):
             if hasattr(module, "__file__"):
                 s = "module '%s' contains no '%s'" % (module.__file__, obj_str)
                 raise AttributeError, s

More information about the Mod_python mailing list