File SOAPSupport-0.6-nxd.patch of Package erp5-SOAPSupport

diff -ruNa erp5-SOAPSupport.orig/SOAPSupport/HTTPRequest.py erp5-SOAPSupport/SOAPSupport/HTTPRequest.py
--- erp5-SOAPSupport.orig/SOAPSupport/HTTPRequest.py	2005-08-03 14:04:54.000000000 +0200
+++ erp5-SOAPSupport/SOAPSupport/HTTPRequest.py	2005-10-17 10:20:34.000000000 +0200
@@ -77,21 +77,24 @@
                 if soap is None:
                       import soap
                 meth, self.args = soap.parse_input(fs.value)
-                response = soap.response(response)
-                response._soap11 = environ.has_key('HTTP_SOAPACTION')
-                response._soap12 = (contentType == 'application/soap+xml')
-                response._contentType = contentType
-                response._method = meth
+                #ALEX : Here we bypass the SOAP Envelope creation by SOAPpy
+                # and do it by ourselves in the SOAP method in the ZODB
+
+                #ALEX response = soap.response(response)
+                #ALEX response._soap11 = environ.has_key('HTTP_SOAPACTION')
+                #ALEX response._soap12 = (contentType == 'application/soap+xml')
+                #ALEX response._contentType = contentType
+                #ALEX response._method = meth
                 other['RESPONSE'] = self.response = response
-                other['REQUEST_METHOD'] = ''
+                #ALEX other['REQUEST_METHOD'] = ''
                 self.maybe_webdav_client = 0
             # Hm, maybe it's an XML-RPC
-            # check for a real XML-RPC methodCall !
-            # This allows to post normal text/xml files to Zope !
-            elif (contentType == 'text/xml' and method == 'POST' and fs.value.find('<methodCall>') > 0):
+            elif (fs.headers.has_key('content-type') and
+                'text/xml' in fs.headers['content-type'] and
+                method == 'POST'):
                 # Ye haaa, XML-RPC!
                 global xmlrpc
-                if xmlrpc is None: from ZPublisher import xmlrpc
+                if xmlrpc is None: import xmlrpc
                 meth, self.args = xmlrpc.parse_input(fs.value)
                 response=xmlrpc.response(response)
                 other['RESPONSE']=self.response=response
@@ -105,7 +108,7 @@
             CGI_name=isCGI_NAME
             defaults={}
             tainteddefaults={}
-            converter=None
+            converter=seqf=None
 
             for item in fslist:
 
@@ -154,8 +157,10 @@
                             converter_type = type_name
                             flags=flags|CONVERTED
                         elif type_name == 'list':
+                            seqf=list
                             flags=flags|SEQUENCE
                         elif type_name == 'tuple':
+                            seqf=tuple
                             tuple_items[key]=1
                             flags=flags|SEQUENCE
                         elif (type_name == 'method' or type_name == 'action'):
@@ -711,7 +716,20 @@
             self._hacked_path=1
 
 
-HTTPRequest.processInputs = processInputs
+#ALEX force iHotfix or Localizer to be loaded before we patch HTTPRequest if available
+try:
+    import Products.iHotfix
+    #ALEX : For this patch to work in conjunction with iHotfix,
+    # we replace the actual method instead of the iHotfix wrapper.
+    HTTPRequest.old_processInputs = processInputs
+except ImportError:
+    try:
+        import Products.Localizer
+        #ALEX : For this patch to work in conjunction with Localizer,
+        # we replace the actual method instead of the Localizer wrapper.
+        HTTPRequest.old_processInputs = processInputs
+    except ImportError:
+        HTTPRequest.processInputs = processInputs
 
 from zLOG import LOG, INFO
 
diff -ruNa erp5-SOAPSupport.orig/SOAPSupport/__init__.py erp5-SOAPSupport/SOAPSupport/__init__.py
--- erp5-SOAPSupport.orig/SOAPSupport/__init__.py	2005-08-03 14:05:18.000000000 +0200
+++ erp5-SOAPSupport/SOAPSupport/__init__.py	2005-10-17 10:20:34.000000000 +0200
@@ -36,43 +36,53 @@
      getZopeVersion()[0:2] == (2,7) or
      getZopeVersion()[0:2] == (2,8)):
 
-	import HTTPRequest
+    import HTTPRequest
 
-	from Products.PythonScripts.Utility import allow_module, allow_class 
+    from Products.PythonScripts.Utility import allow_module, allow_class
 
-	allow_module('base64')
+    allow_module('base64')
 
-	allow_module('SOAPpy')
-	allow_module('SOAPpy.Types')
+    allow_module('SOAPpy')
+    allow_module('SOAPpy.Types')
+
+    #ALEX : Allow usage of SOAPpy Types classes instances
+    # to build a SOAP response.
+    # Note : as we decided to build SOAP messages from scratch,
+    # is this still usefull ?
+    import SOAPpy.Types
+    for type_name in dir(SOAPpy.Types):
+        type_class = getattr(SOAPpy.Types, type_name)
+        if type(type_class) == type(SOAPpy.Types.stringType):
+            allow_class(type_class)
 
 
 try:
 
-	from WSDLObject import WSDLObject, \
-		manage_addWSDLObjectForm, manage_addWSDLObject, \
-		ADD_WSDL_OBJECT_PERMISSION
-	
-	def initialize(context):
-
-		context.registerClass(
-			WSDLObject,
-			permission   = ADD_WSDL_OBJECT_PERMISSION,
-			constructors = ( manage_addWSDLObjectForm, manage_addWSDLObject ),
-			icon='icons/wsdlobject.gif',
-			meta_type = WSDLObject.meta_type
-			)
-
-		context.registerBaseClass(WSDLObject)
-
-		try:
-			from Products.ZBabel import ZBabelTag
-		except:
-			import NoBabelTag
+    from WSDLObject import WSDLObject, \
+        manage_addWSDLObjectForm, manage_addWSDLObject, \
+        ADD_WSDL_OBJECT_PERMISSION
+
+    def initialize(context):
+
+        context.registerClass(
+            WSDLObject,
+            permission   = ADD_WSDL_OBJECT_PERMISSION,
+            constructors = ( manage_addWSDLObjectForm, manage_addWSDLObject ),
+            icon='icons/wsdlobject.gif',
+            meta_type = WSDLObject.meta_type
+            )
+
+        context.registerBaseClass(WSDLObject)
+
+        try:
+            from Products.ZBabel import ZBabelTag
+        except:
+            import NoBabelTag
 
 
 except:
-	
-	import traceback
-	traceback.print_exc()
 
-#	vim:ts=4
+    import traceback
+    traceback.print_exc()
+
+#    vim:ts=4
diff -ruNa erp5-SOAPSupport.orig/SOAPSupport/soap.py erp5-SOAPSupport/SOAPSupport/soap.py
--- erp5-SOAPSupport.orig/SOAPSupport/soap.py	2005-10-14 20:15:02.000000000 +0200
+++ erp5-SOAPSupport/SOAPSupport/soap.py	2005-10-17 10:20:34.000000000 +0200
@@ -26,7 +26,9 @@
     """
     body = parseSOAPRPC(data)
     method = body._name
-    params = tuple(body._aslist())
+    #ALEX : Here we prefer to get a structure of SOAP Types instead of just the data.
+    #ALEX params = tuple(body._aslist())
+    params = (body,)
 
     # Translate '.' to '/' in meth to represent object traversal.
     method = replace(method, '.', '/')
openSUSE Build Service is sponsored by