[Checkins] SVN: z3c.soap/trunk/ handle zsi.fault
Jean-Fran�ois Roche
jfroche at jfroche.be
Wed Dec 17 10:09:52 EST 2008
Log message for revision 94149:
handle zsi.fault
Changed:
U z3c.soap/trunk/docs/HISTORY.txt
U z3c.soap/trunk/setup.py
U z3c.soap/trunk/z3c/soap/README.txt
U z3c.soap/trunk/z3c/soap/permissions.py
U z3c.soap/trunk/z3c/soap/soap.py
-=-
Modified: z3c.soap/trunk/docs/HISTORY.txt
===================================================================
--- z3c.soap/trunk/docs/HISTORY.txt 2008-12-17 14:57:56 UTC (rev 94148)
+++ z3c.soap/trunk/docs/HISTORY.txt 2008-12-17 15:09:52 UTC (rev 94149)
@@ -1,6 +1,11 @@
Changelog
=========
+0.3 - (2008-12-17)
+------------------
+
+â Handle correclty ZSI.Fault exception
+
0.2 - (2008-11-14)
------------------
Modified: z3c.soap/trunk/setup.py
===================================================================
--- z3c.soap/trunk/setup.py 2008-12-17 14:57:56 UTC (rev 94148)
+++ z3c.soap/trunk/setup.py 2008-12-17 15:09:52 UTC (rev 94149)
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = '0.2'
+version = '0.3'
setup(name='z3c.soap',
version=version,
Modified: z3c.soap/trunk/z3c/soap/README.txt
===================================================================
--- z3c.soap/trunk/z3c/soap/README.txt 2008-12-17 14:57:56 UTC (rev 94148)
+++ z3c.soap/trunk/z3c/soap/README.txt 2008-12-17 15:09:52 UTC (rev 94149)
@@ -14,6 +14,7 @@
Let's write a simple SOAP view that echoes various types of input:
+ >>> import ZSI
>>> from Products.Five import BrowserView
>>> class EchoView(BrowserView):
...
@@ -62,8 +63,12 @@
... mail = requestData._Email
... response._Status = '%s is OK' % mail
... return response
+ ...
+ ... def testFault(self):
+ ... raise ZSI.Fault(ZSI.Fault.Client, "Testing the zsi fault")
+
Now we'll register it as a SOAP view. For now we'll just register the
view for folder objects and call it on the root folder:
@@ -86,7 +91,8 @@
... for="OFS.interfaces.IFolder"
... methods="echoString echoStringArray echoInteger echoIntegerArray
... echoFloat echoFloatArray echoStruct echoVoid echoBase64
- ... echoDate echoDecimal echoBoolean ValidateEmailRequest"
+ ... echoDate echoDecimal echoBoolean ValidateEmailRequest
+ ... testFault"
... class="z3c.soap.README.EchoView"
... permission="zope2.SOAPAccess"
... />
@@ -615,7 +621,35 @@
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Processing Failure</faultstring><detail><ZSI:FaultDetail><ZSI:string>
...
+Here is a ZSI Fault response:
+ >>> print http(r"""
+ ... POST /test_folder_1_ HTTP/1.0
+ ... Authorization: Basic %s:%s
+ ... Content-Length: 104
+ ... Content-Type: text/xml
+ ... SOAPAction: /
+ ...
+ ... <?xml version="1.0"?>
+ ... <SOAP-ENV:Envelope
+ ... SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+ ... xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+ ... xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ ... xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ ... xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ ... <SOAP-ENV:Body>
+ ... <m:testFault xmlns:m="http://www.soapware.org/">
+ ... </m:testFault>
+ ... </SOAP-ENV:Body>
+ ... </SOAP-ENV:Envelope>
+ ... """ % (user_name, user_password), handle_errors=True)
+ HTTP/1.0 200 OK
+ Content-Length: 488
+ Content-Type: text/xml
+ <BLANKLINE>
+ <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Testing the zsi fault</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
+
+
Complex Types
-------------
Modified: z3c.soap/trunk/z3c/soap/permissions.py
===================================================================
--- z3c.soap/trunk/z3c/soap/permissions.py 2008-12-17 14:57:56 UTC (rev 94148)
+++ z3c.soap/trunk/z3c/soap/permissions.py 2008-12-17 15:09:52 UTC (rev 94149)
@@ -19,4 +19,4 @@
security.declarePublic('SOAP Access')
SoapAccess = 'SOAP Access'
-setDefaultRoles(SoapAccess, ('Authenticated', ))
+setDefaultRoles(SoapAccess, ('Manager', ))
Modified: z3c.soap/trunk/z3c/soap/soap.py
===================================================================
--- z3c.soap/trunk/z3c/soap/soap.py 2008-12-17 14:57:56 UTC (rev 94148)
+++ z3c.soap/trunk/z3c/soap/soap.py 2008-12-17 15:09:52 UTC (rev 94149)
@@ -127,7 +127,7 @@
content = "".join(traceback.format_tb(tb))
logger = logging.getLogger('Zope')
logger.info('SOAPException: %s' % content)
- f=None
+ f=v
if t == 'Unauthorized' or t == Unauthorized or (
isinstance(t, types.ClassType) and issubclass(t, Unauthorized)):
self._real.setStatus(401)
More information about the Checkins
mailing list