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

Brian Hawthorne brianh at exelixis.com
Thu Dec 12 11:26:42 EST 2002


i'm not sure what the point is of wrapping the field object like this.
why not just use the field object itself as the value for the file upload
arg?  i cut this part out of my publisher because it seemed unnecessary.

brian hawthorne


On Thu, 12 Dec 2002, Manera, Villiam wrote:

> 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
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
> 




More information about the Mod_python mailing list