R: [mod_python] problem in file download

Christopher Sean Hilton chris at vindaloo.com
Fri Jun 7 09:07:48 EST 2002


On Fri, Jun 07, 2002 at 02:32:13PM +0200, Manera, Villiam wrote:
> Wow!!!!! publisher.py patched with this function work fine!!!!
> 
> class File:
>     """ Like a file, but also has headers and filename
>     """
>     def __init__(self, field):
>         # steal all the file-like methods
>         #for m in field.file.__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
>     
>     def sim_methods(self,obj):
>         from types import BuiltinMethodType   #parte aggiunta
>         return filter(lambda s, t=obj:
>            type(getattr(t, s)) == BuiltinMethodType, dir(obj))
> 
> 

That's the way to do it. I agree that having to downgrade to 2.1 seems a bit 
extreme but the way I was looking at it the is probably not the only piece 
of obsolete code modpython. You are probably right though and it's certain 
that the patch needs to be written.

Chris
-- 
Chris Hilton                                 chilton-at-vindaloo-dot-com
------------------------------------------------------------------------
                "All I was doing was trying to get home from work!"
                                                 -- Rosa Parks



More information about the Mod_python mailing list