R: [mod_python] upload binary file

Manera, Villiam vmanera at manord.com
Wed Apr 16 19:27:52 EST 2003


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
>



-----Messaggio originale-----
Da: Julio Mendoza [mailto:jm at eemsystems.cjb.net]
Inviato: lunedì 14 aprile 2003 15.55
A: mod_python at modpython.org
Oggetto: [mod_python] upload binary file


Is posible to upload a binary file using mod_python?

Tank you,

JM



Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 193, in
Dispatch
    result = object(req)

  File "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 104,
in handler
    val = File(field)

  File "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 308,
in __init__
    for m in field.file.__methods__:

AttributeError: 'file' object has no attribute '__methods__'
-- 
Julio Mendoza <jm at eemsystems.cjb.net>

_______________________________________________
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