[Zope] Re: cannot access POST content in Zope

2007-08-20 Thread Manuel Spuhler
Thank you Tres,

if you have this problem, there is something in the Zope FAQ (!)
http://wiki.zope.org/zope2/FAQ#i-want-to-post-xml-content-but-zope-assumes-a-xmlrpc-request

For my Zope 2.9, the configure.zcml file would not work.
At first sight the XmlFix could work for Zope 2.9, it didn't for me
because I have SOAPSupport installed, which already patch
ZPublisher.HTTPRequest

So I patched ZPublisher.HTTPRequest again

## this is MS hack to disable xmlrpc and send back the text/xml
  # Hm, maybe it's an XML-RPC
if (fs.headers.has_key('content-type') and
'text/xml' in fs.headers['content-type'] and method == 'POST'):
form['xml']= fs.value
self.maybe_webdav_client = 0

I had to add a xml key, because as Tres Seaver said, ( I just
understood what you wrote when I dug into Zope, thank you for your
help ) the xml body is not marshalled. Then I got my xml back in
request.form['xml']

I'm not a Zope specialist, so it might sound terrible to do it like
this. If you have a nice way to code it, I'd love to learn it. At last
it works fine for me.

Regards

Manuel Spuhler
www.rsr.ch
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: cannot access POST content in Zope

2007-08-17 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Manuel Spuhler wrote:
 Hi Andreas,
 
 thank for your answer
 
 No idea where and how you look for the uploaded content.
 Everything in Zope is available from the REQUEST. And of course you  
 can _not_ upload something to the mutator method of some object.  
 This makes zero sense.
 You might write your script that takes the data from the REQUEST  
 and calls the API method e.g. a mutator method.
 
 I think you misunderstood, curl send it in a form,  content is not  
 *uploaded* but encoded in a POST 'text/xml'
 and it's sent to a  script  from which which I look at  
 request.RESPONSE.form, but it's empty when content-type is  
 'application/x-www-form-urlencoded'
 my problem is probably about content-type

If you are POSTing XML as the payload of your REQUEST, then the 'form'
element *must* be empty:  Zope's form marshalling doesn't know what to
do with such a mess.  You will need to parse REQUEST.body yourself, in
such a case.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGxctK+gerLs4ltQ4RAgnrAKC1SES5XJH93fJQKf9+zIKQNs+cpwCgpdJg
hvaZBLycgNwUu8rsAMk2aFE=
=sH90
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )