Okay I think I understand the problem.  The form data is being saved
as file data; the request.form data shows up as request.files instead.

the bug appears to be in http.parse_multipart():

            content_type = headers.get('content-type')
            if content_type is None:
                is_file = False
            else:
                content_type = parse_options_header(content_type)[0]
                is_file = True


content-type header is not None for any of the form fields in the form
body, so Werkzeug thinks the form fields are files.



Is that correct to assume that forms have no content-type header?

Could the content-disposition header be used to determine form/file?


Robin






On Sep 26, 5:18 pm, Robin B <[email protected]> wrote:
> Looks like Google Groups mangled the text, so here is a Paste of the
> form body:
>
> http://paste.pocoo.org/show/141651/
>
> Robin
>
> On Sep 26, 5:13 pm, Robin B <[email protected]> wrote:
>
> > This is the form body without truncated lines:
>
> > ------=_Part_2527_11760094.1254002398313
>
> > Content-Type: text/plain; charset="UTF-8"
>
> > Content-Disposition: form-data; name="from"
>
> > [email protected]/Adium459518AF
>
> > ------=_Part_2527_11760094.1254002398313
>
> > Content-Type: text/plain; charset="UTF-8"
>
> > Content-Disposition: form-data; name="to"
>
> > [email protected]/bot
>
> > ------=_Part_2527_11760094.1254002398313
>
> > Content-Type: text/plain; charset="UTF-8"
>
> > Content-Disposition: form-data; name="body"
>
> > hello world
>
> > ------=_Part_2527_11760094.1254002398313
>
> > Content-Type: text/xml; charset="UTF-8"
>
> > Content-Disposition: form-data; name="stanza"
>
> > <cli:message type="chat" id="purplea635bb6d" to="[email protected]/bot"
> > from="[email protected]/Adium459518AF"
> > xmlns:cli="jabber:client"><cli:body>hello world</cli:body><nos:x
> > value="disabled" xmlns:nos="google:nosave"/><arc:record otr="false"
> > xmlns:arc="http://jabber.org/protocol/archive"/></cli:message>
>
> > ------=_Part_2527_11760094.1254002398313--
>
> > Robin
>
> > On Sep 26, 5:09 pm, Robin B <[email protected]> wrote:
>
> > > I am trying out XMPP support on GAE, and you get a webhook POST for
> > > each incoming message.
>
> > > When I parse the form data with WebOb (request.POST) I get correct
> > > data:
>
> > > UnicodeMultiDict([(u'from', u'[email protected]/Adium459518AF'), (u'to',
> > > u'[email protected]/bot'), (u'body', u'hello world'), (u'stanza',
> > > u'<cli:message type="chat" id="purplea635bb6d" to="[email protected]/
> > > bot" from="[email protected]/Adium459518AF"
> > > xmlns:cli="jabber:client"><cli:body>hello world</cli:body><nos:x
> > > value="disabled" xmlns:nos="google:nosave"/><arc:record otr="false"
> > > xmlns:arc="http://jabber.org/protocol/archive"/></cli:message>')])
>
> > > When I parse the form data with Werkzeug (request.form) I get no data:
>
> > > ImmutableMultiDict([])
>
> > > For some reason Werkzeug is not parsing this form body (double spaced
> > > from logging):
>
> > > ------=_Part_2527_11760094.1254002398313
>
> > > Content-Type: text/plain; charset="UTF-8"
>
> > > Content-Disposition: form-data; name="from"
>
> > > [email protected]/Adium459518AF
>
> > > ------=_Part_2527_11760094.1254002398313
>
> > > Content-Type: text/plain; charset="UTF-8"
>
> > > Content-Disposition: form-data; name="to"
>
> > > [email protected]/bot
>
> > > ------=_Part_2527_11760094.1254002398313
>
> > > Content-Type: text/plain; charset="UTF-8"
>
> > > Content-Disposition: form-data; name="body"
>
> > > hello world
>
> > > ------=_Part_2527_11760094.1254002398313
>
> > > Content-Type: text/xml; charset="UTF-8"
>
> > > Content-Disposition: form-data; name="stanza"
>
> > > <cli:message type="chat" id="purplea635bb6d" to="[email protected]/bot"
> > > from="[email protected]/Adium459518AF"
> > > xmlns:cli="jabber:client"><cli:body>hel
>
> > > ------=_Part_2527_11760094.1254002398313--
>
> > > I tried versions Werkzeug versions 0.5.0 and 0.5.1, and neither parses
> > > the form data.
>
> > > Kind of a show stopper, any ideas?
>
> > > thanks,
>
> > > Robin
>
>
--~--~---------~--~----~------------~-------~--~----~
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