[mod_python] problem with file download in mod-python 3.0.1

Manera, Villiam vmanera at manord.com
Thu Dec 12 17:47:45 EST 2002


I'm testing mod-python 3.0.1 with apache 2.0.43 and python 2.2.2

I've founded a older problem in file download (from python 2.1 to 2.2)

the workaround is still the same:

in publisher.py:

 class File:
     """ Like a file, but also has headers and filename
     """
     def __init__(self, field):
         # steal all the file-like methods
         for m in dir(field.file):            
		 self.__dict__[m] = getattr(field.file, m)
 
         self.headers = field.headers
         self.filename = field.filename
======================workaround
==============================================
 class File:
     """ Like a file, but also has headers and filename
     """
     def __init__(self, field):
         # steal all the file-like methods
         #for m in dir(field.file):    #dont' work
         for m in self.sim_methods(field.file):
             self.__dict__[m] = getattr(field.file, m)
 
         self.headers = field.headers
         self.filename = field.filename
    
	#new--------	
     def sim_methods(self,obj):
         from types import BuiltinMethodType   
         return filter(lambda s, t=obj:
            type(getattr(t, s)) == BuiltinMethodType, dir(obj))
 
 
I hope it will be put in place

regards

Villiam Manera



More information about the Mod_python mailing list