[mod_python] Upload troubles in Debian

Graham Dumpleton graham.dumpleton at gmail.com
Sun Jan 20 01:20:06 EST 2008


Use:

def upload(req):
   fp = req.form['fileupload'].file
   return str(type(fp))

Using latest version of mod_python is also suggested.

Graham

On 20/01/2008, William Witteman <yam at nerd.cx> wrote:
> I have a server running Debian stable, and I am new to mod_python and
> trying to get file uploads handled under the publisher handler.
>
> Here's the test code:
>
> #!/usr/bin/python
>
> html = """
> <html><body>
> <form action="upload" method="POST" enctype="multipart/form-data">
>   <input type="file" name="fileupload"/>
>   <input type="submit" value="Upload!">
> </form>
> </body></html>
> """
>
> def index(req):
>     return html
>
> def upload(req):
>     fp = req.form['fileupload'].file
>     return type(fp)
>
>
> Here's the error:
>
> Mod_python error: "PythonHandler mod_python.publisher"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch
>     result = object(req)
>
>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 213, in handler
>     published = publish_object(req, object)
>
>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 412, in publish_object
>     return publish_object(req,util.apply_fs_data(object, req.form, req=req))
>
>   File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 412, in publish_object
>     return publish_object(req,util.apply_fs_data(object, req.form, req=req))
>
>   File "/usr/lib/python2.4/site-packages/mod_python/util.py", line 401, in apply_fs_data
>     fc = object.__init__.im_func.func_code
>
> AttributeError: 'wrapper_descriptor' object has no attribute 'im_func'
>
> I'm not sure what to try next.  Any help would be appreciated.  Thanks.
> --
>
> yours,
>
> William
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list