R: [mod_python] How to upload files using mod_python's publisher handler?

Andres Meza andres.meza at nuevosmedios.ws
Fri Sep 13 10:52:44 EST 2002


It works quite well!

Thanks a lot for your patch. Do you know if this bug-fix or the
equivalent one will be included in future versions of mod_python ?

Best regards,
-- 
   Andrés Meza
   Technical Manager
 __Nuevos Medios - NM S.A.____________________
   e-mail:         andres.meza at nuevosmedios.ws
   day time phone: (+572)6827794 ext.102
   url:            www.nuevosmedios.ws

El vie, 13-09-2002 a las 04:05, Manera, Villiam escribió:

    try this: 
    
     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))
    
     
    
     
    
    Villiam

        -----Messaggio originale-----
        Da: Andres Meza [mailto:andres.meza at nuevosmedios.ws]
        Inviato: giovedì 12 settembre 2002 20.21
        A: mod_python at modpython.org
        Oggetto: [mod_python] How to upload files using mod_python's
        publisher handler?
        
        
        Greetings. 
        
        I have created a python CGI script that can upload files
        sucessfully. Now, I want to create a mod_python script with the
        same feature using the "publisher" handler and I get this
        error:   
        
        
        [Thu Sep 12 08:53:41 2002] [error] PythonHandler
        mod_python.publisher: Traceback (most recent call last): 
        [Thu Sep 12 08:53:41 2002] [error] PythonHandler
        mod_python.publisher:   File
        "/home/mrnet/rpm/tmp/mod_python-root/usr/lib/python2.2/site-packages/mod_python/apache.py", line 193, in Dispatch 
        [Thu Sep 12 08:53:41 2002] [error] PythonHandler
        mod_python.publisher:   File
        "/home/mrnet/rpm/tmp/mod_python-root/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 104, in handler 
        [Thu Sep 12 08:53:41 2002] [error] PythonHandler
        mod_python.publisher:   File
        "/home/mrnet/rpm/tmp/mod_python-root/usr/lib/python2.2/site-packages/mod_python/publisher.py", line 308, in __init__ 
        [Thu Sep 12 08:53:41 2002] [error] PythonHandler
        mod_python.publisher: AttributeError: 'file' object has no
        attribute '__methods__' 
        
        Anyone have an idea about why I get this error? 
        
        Thanks for your time, 
        -- 
           Andrés Meza
           Technical Manager
         __Nuevos Medios - NM S.A.____________________
           e-mail:         andres.meza at nuevosmedios.ws
           day time phone: (+572)6827794 ext.102
           url:            www.nuevosmedios.ws


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.modpython.org/pipermail/mod_python/attachments/20020913/d5b46a96/attachment-0003.htm


More information about the Mod_python mailing list