[mod_python] python module loaded, but not parsed (huh?)

Fabiano Sidler fabianosidler at gmail.com
Sat Jan 14 06:57:41 EST 2006

2006/1/14, Graham Dumpleton <grahamd at dscpl.com.au>:
> I used the term "complicated" because you use features line
> metaclasses, static methods creation, overloading of new, etc. It just
> seems to fail the test of keeping it simple for me. I can't really see the
> reason for doing it all.

The reason is that the user of my interface shouldn't have to care
about things like a "req" object as well as applications using the
interface should work without any change of code. Therefore,
server-specific things must be done while importing the container, as
there is, for example, setting the global name 'handler'.

> You were somehow trying to stuff the handler() method
> into a module of a class, but that wasn't going to work as the type of
> cls.__module__ is a string not a module, so attempts to set Request
> and handler in the module were going to be applied to a string object.

Oops, my mistake! It was an untested example. In my other code, I pass
sys.modules[cls.__module__] to loadmodule(), not cls.__module__
itself. Sorry for confusion!
The strange thing is still the same: Why is the module string of the
metaclass module being passed to loadmodule instead of the module
string of the class object being created by the metaclass,
cls.__module__? I can't see a solution for this! :(


More information about the Mod_python mailing list