[Zope-dev] z3c.form: data manager for PersistentDict/PersistentMapping

2009-07-11 Thread Michael Howitz
Hello,

z3c.form.datamanager.DictionaryField is a data manager which is  
registered for fields on a dict. In its __init__ it checks whether the  
data object is an instance of dict. So this data manager does neither  
work for UserDict nor PersistentDict/PersistentMapping.
I'd like to change this but there are two possibilities and I'm not  
sure which is the best one:

1.) Add a subclasses of DictionaryField which is registered for  
UserDict and which checks whether the data object is an instance of  
UserDict.
 (PersistentDict and PersistentMapping are subclasses of UserDict.)

2.) Register DictionaryField for  
zope.interface.common.mapping.IMapping. This might have a problem as  
neither UserDict nor PersistentDict/PersistentMapping seem to provide  
this interface. (Why?)

Any suggestions?

Yours sincerely,
-- 
Michael Howitz · m...@gocept.com · software developer
gocept gmbh  co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development

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


Re: [Zope] Problem with POST and text/xml

2009-07-11 Thread Jonathan (dev101)

- Original Message - 
From: Andreas Jung li...@zopyx.com
To: Jonathan (dev101) dev...@magma.ca
Cc: zope@zope.org
Sent: Friday, July 10, 2009 4:30 PM
Subject: Re: [Zope] Problem with POST and text/xml


 https://bugs.launchpad.net/zope2/+bug/373663

 -aj

 On 10.07.09 21:24, Jonathan (dev101) wrote:
 I need to support a third party web service (which is not within my 
 control)
 that wants to send xml data to my zope server (Zope 2.9.2 running on 
 Redhat
 linux).

 When Zope receives a POST request with a Content-Type of text/xml it 
 assumes
 that it is an xmlrpc call (which it is not - it is just passing xml data
 within the POST request).

 Is there a way to get Zope to turn off this xmlrpc assumption so that 
 my
 zope external method can process the xml data that is being passed?


 Thanks,

 Jonathan

Thanks for the link!

There were some differences between my Zope 2.9.2 installation and the patch 
instructions:

1) There was no interfaces.py file in the ZPublisher source directory (so I 
created a new one)
2) There were some differences in the HTTPRequest.py file, but it was still 
possible to make the changes indicated in the patch instructions.

I restarted Zope via the ZMI, and ran a test (which generated a 500 response 
error). I noticed that there were no pyc/pyo files for interfaces.py and 
HTTPRequest.py, so I created them manually using py_compile.

I restarted Zope and ran another test (using wget to simulate a POST request 
containing xml data) and got a 503 response:

---response begin---
HTTP/1.0 503 Service Unavailable
Server: Zope/(Zope 2.9.2-, python 2.4.2, linux2) ZServer/1.1
Date: Sat, 11 Jul 2009 14:04:08 GMT
Bobo-Exception-Line: 402
Content-Length: 995
Bobo-Exception-Value: See the server error log for details
Content-Type: text/html; charset=iso-8859-15
Bobo-Exception-Type: NameError
Connection: Keep-Alive
Bobo-Exception-File: HTTPRequest.py


There were no entries in Z2.log or event.log.

Other than manually creating pyc/pyo files and re-starting zope, is there 
anything else I need to do to implement the changes to interfaces.py and 
HTTPRequest.py?  If not, any ideas as to what could be causing this error or 
how I could go about debugging it?


Thanks,

Jonathan


___
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 )


Re: [Zope] Problem with POST and text/xml

2009-07-11 Thread Andreas Jung
On 11.07.09 15:22, Jonathan (dev101) wrote:

 There were some differences between my Zope 2.9.2 installation and the patch 
 instructions:

   
Zope 2.9 is pretty much out-of-date.

-aj

-- 
ZOPYX Ltd.  Co KG  \  ZOPYX  Friends
Charlottenstr. 37/1  \  Das Expertennetzwerk für Python, Zope
D-72070 Tübingen  \  und Plone Projekte
www.zopyx.com, i...@zopyx.com  \  www.zopyx.de/friends, frie...@zopyx.de

E-Publishing, Python, Zope  Plone development, Consulting


begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:i...@zopyx.com
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
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 )


Re: [Zope] Problem with POST and text/xml

2009-07-11 Thread Peter Bengtsson
Roughly because of this I ended up writing the web service part of the
app in Grok instead of Zope.

2009/7/10 Jonathan (dev101) dev...@magma.ca:
 I need to support a third party web service (which is not within my control)
 that wants to send xml data to my zope server (Zope 2.9.2 running on Redhat
 linux).

 When Zope receives a POST request with a Content-Type of text/xml it assumes
 that it is an xmlrpc call (which it is not - it is just passing xml data
 within the POST request).

 Is there a way to get Zope to turn off this xmlrpc assumption so that my
 zope external method can process the xml data that is being passed?


 Thanks,

 Jonathan


 P.S.  details of a wget session that illustrate the error being generated
 follows:

 Setting --header (header) to Content-Type: text/xml
 Setting --post-data (postdata) to ?xml version=1.0 encoding=ISO-8859-1
 ?
 bulkMtNotification
  transactionId235006/transactionId
  triggerId1160/triggerId
  messagetest #27/message
  date2007-09-14 15:52:59/date
  phoneNumber+11234567890/phoneNumber
  carrierId26/carrierId
  carrierNameSprint/carrierName
  shortCode5/shortCode
  /bulkMtNotification
 DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

 --16:12:28--  http://192.168.123.2:8080/Coz/Process3Ci
           = `Process3Ci.1'
 Connecting to 192.168.123.2:8080... connected.
 Created socket 3.
 Releasing 0x00638c60 (new refcount 0).
 Deleting unused 0x00638c60.

 ---request begin---
 POST /Coz/Process3Ci HTTP/1.0
 User-Agent: Wget/1.10.2 (Red Hat modified)
 Accept: */*
 Host: 192.168.123.2:8080
 Connection: Keep-Alive
 Content-Type: text/xml
 Content-Length: 390

 ---request end---
 [POST data: ?xml version=1.0 encoding=ISO-8859-1 ?
 bulkMtNotification
  transactionId235006/transactionId
  triggerId1160/triggerId
  messagetest #27/message
  date2007-09-14 15:52:59/date
  phoneNumber+11234567890/phoneNumber
  carrierId26/carrierId
  carrierNameSprint/carrierName
  shortCode5/shortCode
  /bulkMtNotification]
 HTTP request sent, awaiting response...
 ---response begin---
 HTTP/1.0 500 Internal Server Error
 Server: Zope/(Zope 2.9.2-, python 2.4.2, linux2) ZServer/1.1
 Date: Fri, 10 Jul 2009 20:12:28 GMT
 Bobo-Exception-Line: 742
 Content-Length: 849
 Bobo-Exception-Value: See the server error log for details
 Content-Type: text/html; charset=iso-8859-15
 Bobo-Exception-Type: ResponseError
 Connection: Keep-Alive
 Bobo-Exception-File: xmlrpclib.py

 ---response end---
 500 Internal Server Error
 Registered socket 3 for persistent reuse.


 ___
 Zope maillist  -  z...@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 )




-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
fun crosstips.org
___
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 )


Re: [Zope] Problem with POST and text/xml

2009-07-11 Thread Michael Haubenwallner
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jonathan (dev101) wrote:
 I need to support a third party web service (which is not within my control) 
 that wants to send xml data to my zope server (Zope 2.9.2 running on Redhat 
 linux).
 
 When Zope receives a POST request with a Content-Type of text/xml it assumes 
 that it is an xmlrpc call (which it is not - it is just passing xml data 
 within the POST request).
 
 Is there a way to get Zope to turn off this xmlrpc assumption so that my 
 zope external method can process the xml data that is being passed?
 

Did you think of using 'application/xml' instead of 'text/xml' ?
Everything should work as expected.

Regards
Michael

- --
http://blog.d2m.at
http://planetzope.org

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKWJj1l0uAvQJUKVYRAlZDAJ9a6wbEnRafVew2jPUttRmNjQKAtQCgh98/
kPSyOmTTHGBUSPmPy0V6Trw=
=s15f
-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 )


Re: [Zope] Problem with POST and text/xml

2009-07-11 Thread Jonathan (dev101)

- Original Message - 
From: Michael Haubenwallner mich...@d2m.at
To: zope@zope.org
Sent: Saturday, July 11, 2009 9:51 AM
Subject: Re: [Zope] Problem with POST and text/xml


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Jonathan (dev101) wrote:
 I need to support a third party web service (which is not within my 
 control)
 that wants to send xml data to my zope server (Zope 2.9.2 running on 
 Redhat
 linux).

 When Zope receives a POST request with a Content-Type of text/xml it 
 assumes
 that it is an xmlrpc call (which it is not - it is just passing xml data
 within the POST request).

 Is there a way to get Zope to turn off this xmlrpc assumption so that 
 my
 zope external method can process the xml data that is being passed?


 Did you think of using 'application/xml' instead of 'text/xml' ?
 Everything should work as expected.

 Regards
 Michael

The POST requests are coming from a third party web service (which we don't 
control, and they have lots of other users) and they won't change the 
content-type just for us to work around a zope bug (sigh).






___
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 )


Re: [Zope] Problem with POST and text/xml

2009-07-11 Thread Jonathan (dev101)
As a quick test I modified HTTPRequest.py to turn off the zope assumption 
that all POST requests with content-type of text/xml are xmlrpc requests.

This had the effect of eliminating the xmlrpc error that zope was raising, 
but a side effect is that the xml data is not available within the REQUEST 
object.

I don't think the patch submitted for bug 373663 will fix this behaviour 
(ie. it will resolve the xmlrpc error, but it won't make the xml data 
contained within the POST request available).

Any ideas on how to get access to the xml data?!  (and re-writing the entire 
app with Grok is not something I really want to do!)

Thanks,

Jonathan


___
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 )