Affects Version/s: 3.3.x, 3.2.10
Fix Version/s: None
When defining a mod_python handler, it is possible to supply a dotted path for the actual handler function to be used. Ie:
when determing the handler to execute, it will use the dotted path to traverse any object hierarchy. Thus the above will execute "function()" of the object instance called "instance" in the module called "module".
If instead one provides:
where 'class' is the name of a class type, then referencing 'function' within that type will result in an instance of the class automatically being created just for the current request, with "function()' then being called on that transient instance of the class.
For an instance of the class to be created in this way, one must access a member function of the class type. If an instance of the class is callable in its own right, ie., has a _call_() method, it is not however possible to say:
To get that to work, you instead have to use:
First change should be that if a class is callable through having a _call() method, then it should not be necessary to reference the __call_() method explicitly, instead, referencing the class type itself should be enough. Ie., using
Note that the code will have to be smart enough to handle both new and old style classes.
The next issue with this automatic initialisation of a class type is that although the _call_() method needs to accept the 'req' argument, the constructor has to as well if it is being created automatically. The code should allow for the case where the class doesn't want to have to deal with the 'req' object as an argument to the constructor. Ie., it should be optional for the constructor, although always still required for the actual function of the class instance being called.