[mod_python] Servlet Loading problem 1 year later

Manera, Villiam vmanera at manord.com
Mon May 22 06:38:42 EDT 2006


This problem happened rarely, but now it raises many times a day.
I modified the servlet.py in order to do some debugging and it seems
that  the statement:
if not issubclass(klass, Servlet): sometimes works and sometimes not.

So this is the code that I modified:

            try:
                if not issubclass(klass, Servlet):
                    raise ValueError
            except:
                from mdnlib import path_logs
                def iteraPadri(f,classe):
                   global isServletDescendant
                   isServletDescendant=False
                   f.write('\n')
                   if classe.__bases__ : 
                      f.write(classe.__name__+' deriva da:
'+classe.__bases__[0].__name__)
                      iteraPadri(f,classe.__bases__[0])
                   else:
                      f.write(classe.__name__)
                      if classe.__name__ == 'Servlet':
isServletDescendant = True
                nome = os.path.join(path_logs,'apache','servlet.txt')
                f = file(nome,'a')
                f.write('\n')
                f.write(time.strftime ('%d/%m/%Y
%H:%M:%S',time.localtime(time.time())))
                if klass: iteraPadri(f,klass)
                if isServletDescendant:
                  f.write(' Non faccio Abortire \n')
                else:
                  f.write('\n')
                  f.write('%s is not a subclass of Servlet (in %s) code:
%s'  
                      % (basename, fname, str(code)) )
                  f.write('\n')
 
f.write('---------------------------------------------')
                  f.write('\n')
                  f.close()
                  raise ValueError, ('%s is not a subclass of Servlet
(in %s) code: %s'
                                   % (basename, fname, str(code)))


So, in except I lookup from the ancestor and if I found Servlet
don't'raise exception.

Below some rows of the log:

19/05/2006 11:20:52
scarica_viti deriva da: docBase_mps_form
docBase_mps_form deriva da: docBase_mps
docBase_mps deriva da: HTMLPage
HTMLPage deriva da: Servlet
Servlet Non faccio Abortire 

19/05/2006 11:21:07
Stat_utente deriva da: docBase_mps_form
docBase_mps_form deriva da: docBase_mps
docBase_mps deriva da: HTMLPage
HTMLPage deriva da: Servlet
Servlet Non faccio Abortire 

19/05/2006 11:23:36
operazioni deriva da: docBase_mps_form_matrici_automatico
docBase_mps_form_matrici_automatico deriva da: docBase_mps_form_matrici
docBase_mps_form_matrici deriva da: docBase_mps_form
docBase_mps_form deriva da: docBase_mps
docBase_mps deriva da: HTMLPage
HTMLPage deriva da: Servlet
Servlet Non faccio Abortire



For example on Friday from 8 am to 11 am all work fine after 11 am the
log became populating...
But every time I found the Servlet as ancestor.

So why issubclass(klass, Servlet) don't return True?

Villiam




More information about the Mod_python mailing list