riteshn wrote:
> Hi
>
> I have a form with a file field. In request handler, I am doing the
> following:
>
>             attachment = req.files[form.attachment.name]
>             data = attachment.read()
>             if len(data):
>                 print(type(attachment))
>                 print attachment.type
>                 open(os.path.join(ATTACHMENTS_DIRECTORY,
> attachment.filename), 'w').write(data)
>
>   
>
> It throws up a traceback like: http://paste.pocoo.org/show/111558/
>
> Though according to the doc at 
> http://werkzeug.pocoo.org/documentation/wrappers,
> it should have the property.
>   
Looking at the Werkzeug source at that revision [1], seems this is a 
documentation bug in Werkzeug. The actual attribute is "content_type", 
and "content_length" also exists. This seems to be the same in tip. I 
have no idea if the docs have changed for the newer unreleased versions.


> Similarly, attachment.data does not work but attachment.read() does

"data" I am not sure about, are you getting the same exception?

Ali

[1] 
http://dev.pocoo.org/projects/werkzeug/browser/werkzeug/utils.py?rev=663%3Aa93240c851ab#L421
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to