Graham Dumpleton
grahamd at dscpl.com.au
Wed May 24 01:17:31 EDT 2006
On 23/05/2006, at 11:30 PM, Manera, Villiam wrote: > Ok! I have PythonHandler mod_python.servlet, and only 5 modules with: >> From mod_python.servlet import * so no hard work for fix. > > Instead a lot with: > from mod_python.servlet import HTMLPage (HTMLPage inherit from > Servlet) > > Sorry for my ignorance, but I have to fix with apache.import_module > () also those that import HTMPLPage? Yes. The original link I pointed you at showed exactly that as an example. http://www.modpython.org/pipermail/mod_python/2004-October/ 016596.html # from servlet import HTMLPage from mod_python import apache servlet = apache.import_module("servlet") HTMLPage = servlet.HTMLPage Graham > -----Messaggio originale----- > Da: Graham Dumpleton [mailto:grahamd at dscpl.com.au] > Inviato: martedì 23 maggio 2006 13.09 > A: Manera, Villiam > Cc: mod_python at modpython... list > Oggetto: Re: R: R: [mod_python] Servlet Loading problem 1 year later > > > On 23/05/2006, at 8:15 PM, Manera, Villiam wrote: > >> I don't use apache.import_module() in any of my own modules. The >> problem arise in developer (linux:RH3 EL mod_python 3.2.8) >> And in the production (linux:RH3 EL mod_python 3.1.5) >> >> If I right understand the article only in mod_python 3.2.8 the new >> module loding is in place. >> >> Villiam > > If you are specifying: > > PythonHandler mod_python.servlet > > or: > > PythonHandler servlet > > if you put the mpservlets code in your handler directory, then you > are. > > This is because the PythonHandler directive uses "apache.import_module > ()". > > All it then takes to cause problems is for you to use: > > import mod_python.servlet > from mod_python import servlet > > or: > > import servlet > > depending on whether mpservlets installed centrally or in handler > directory. > > If this is the case, you might solve the problem by using > "apache.import_module()" > to import "mod_python.servlet" etc. > > Graham > >> On 22/05/2006 at 22:56 Graham Dumpleton wrote: >> >>> Please keep followups on list. >> >>> You don't need to actually touch servlet.py to get problems if you >> happen to be using "import" and "apache.import_module ()" on the same >> module at different times. This is because of an issue in the >> mod_python >> importer. See: >> >>> >> http://www.dscpl.com.au/articles/modpython-003.html#redundant- >> module-loa >> ding >> >>> Sorry for quick reply, in a rush. I'll try and comment later on the >> whole issue of checking subclass types and caching. >> >>> Graham >> >> On 22/05/2006, at 11:06 PM, Manera, Villiam wrote: >> >>> Yes, i knows that it could be happened if I touch servlet.py becouse >>> Daniel Popowiwich told me 1 year ago. >>> >>> .... >
|