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

Gregory (Grisha) Trubetskoy grisha at modpython.org
Fri Dec 20 16:34:37 EST 2002


I must be missing something obvious, but without testing it and just by
looking at the code, I'm not sure I understand what the benefit is of
filtering out BuiltinMethodType, as opposed to just using straight
dir(obj).

The above might be a moot point since just as Brian Hawthorne suggested
I'm not sure why we don't need the File class at all and am in the process
of trying to fish out any memories from my tired brain about how it came
about in the fist place....

Grisha

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