Commits

Michael Sommerville committed c6a35a4

Import existing patches

Comments (0)

Files changed (10)

+# HG changeset patch
+# Parent 8f082acada663bceb0e3042ff40aeae77bba74ec
+Remove requirement for setuptools in setup.py
+
+diff -r 8f082acada66 setup.py
+--- a/setup.py	Fri Sep 10 13:51:47 2010 +0000
++++ b/setup.py	Tue Sep 14 08:26:11 2010 +0100
+@@ -18,7 +18,8 @@
+ 
+ import sys
+ import suds
+-from setuptools import setup, find_packages
++import setup
++from distutils.core import setup
+ 
+ setup(
+     name="suds",
+@@ -28,6 +29,6 @@
+     author_email="jortel@redhat.com",
+     maintainer="Jeff Ortel",
+     maintainer_email="jortel@redhat.com",
+-    packages=find_packages(exclude=['tests']),
++    packages= ['suds', 'suds.bindings', 'suds.mx', 'suds.sax', 'suds.transport', 'suds.umx','suds.xsd'],
+     url="https://fedorahosted.org/suds",
+ )
+# Placed by Bitbucket
+no.setuptools
+suds.misc.fix
+suds.wsdl-namespace
+suds.international
+suds.cache-binary-mode
+suds.cache-mod-time
+suds.hack-property-appending
+#suds.fault-object
+#suds.create-non-existing-cache

suds.cache-binary-mode

+# HG changeset patch
+# User Mike Lin <mike.m.lin@gmail.com>
+# Date 1311382821 25200
+# Node ID 53776e31a0e21ccbe8960a45611c168c5bee79c1
+# Parent  96b57e9731c3822201649d428cc14cb183a3cca4
+Open file in binary mode before pickling or unpickling
+
+diff -r 96b57e9731c3 -r 53776e31a0e2 suds/cache.py
+--- a/suds/cache.py	Sat Jul 23 11:34:37 2011 +0100
++++ b/suds/cache.py	Fri Jul 22 18:00:21 2011 -0700
+@@ -190,7 +190,7 @@
+     def put(self, id, bfr):
+         try:
+             fn = self.__fn(id)
+-            f = self.open(fn, 'w')
++            f = self.open(fn, 'wb')
+             f.write(bfr)
+             f.close()
+             return bfr
+@@ -223,7 +223,7 @@
+         try:
+             fn = self.__fn(id)
+             self.validate(fn)
+-            return self.open(fn)
++            return self.open(fn, 'rb')
+         except:
+             pass
+ 

suds.cache-mod-time

+# HG changeset patch
+# User Michael Sommerville <msommerville@gmail.com>
+# Date 1311417277 -3600
+# Node ID 96b57e9731c3822201649d428cc14cb183a3cca4
+# Parent  3162ce5f758d8ad85658b437e30b479a304cf159
+Use modification times of cached objects
+
+diff -r 3162ce5f758d -r 96b57e9731c3 suds/cache.py
+--- a/suds/cache.py	Mon Jul 11 21:10:25 2011 +0000
++++ b/suds/cache.py	Sat Jul 23 11:34:37 2011 +0100
+@@ -235,9 +235,9 @@
+         """
+         if self.duration[1] < 1:
+             return
+-        created = dt.fromtimestamp(os.path.getctime(fn))
++        modified = dt.fromtimestamp(os.path.getmtime(fn))
+         d = { self.duration[0]:self.duration[1] }
+-        expired = created+timedelta(**d)
++        expired = modified+timedelta(**d)
+         if expired < dt.now():
+             log.debug('%s expired, deleted', fn)
+             os.remove(fn)

suds.create-non-existing-cache

+Create suds cache if it doesn't exist
+
+diff -r f87e85a37e05 suds/cache.py
+--- a/suds/cache.py	Wed Apr 21 12:22:05 2010 +0100
++++ b/suds/cache.py	Mon Apr 26 17:24:43 2010 +0100
+@@ -267,8 +267,7 @@
+     def checkversion(self):
+         path = os.path.join(self.location, 'version')
+         try:
+-            
+-            f = open(path)
++            f = self.open(path)
+             version = f.read()
+             f.close()
+             if version != suds.__version__:

suds.fault-object

+diff -r 7b870e852ca1 suds/bindings/binding.py
+--- a/suds/bindings/binding.py	Fri Apr 09 20:34:49 2010 +0100
++++ b/suds/bindings/binding.py	Mon Apr 19 10:48:13 2010 +0100
+@@ -149,21 +149,31 @@
+         soapenv = replyroot.getChild('Envelope')
+         soapenv.promotePrefixes()
+         soapbody = soapenv.getChild('Body')
+-        soapbody = self.multiref.process(soapbody)
+-        nodes = self.replycontent(method, soapbody)
+-        rtypes = self.returned_types(method)
+-        if len(rtypes) > 1:
+-            result = self.replycomposite(rtypes, nodes)
+-            return (replyroot, result)
+-        if len(rtypes) == 1:
+-            if rtypes[0].unbounded():
+-                result = self.replylist(rtypes[0], nodes)
++        #Test if this message is a soap fault or not
++        fault = soapbody.getChild('Fault')
++        if fault is None:
++            soapbody = self.multiref.process(soapbody)
++            nodes = self.replycontent(method, soapbody)
++            rtypes = self.returned_types(method)
++            if len(rtypes) > 1:
++                result = self.replycomposite(rtypes, nodes)
+                 return (replyroot, result)
+-            if len(nodes):
+-                unmarshaller = self.unmarshaller()
+-                resolved = rtypes[0].resolve(nobuiltin=True)
+-                result = unmarshaller.process(nodes[0], resolved)
+-                return (replyroot, result)
++            if len(rtypes) == 1:
++                if rtypes[0].unbounded():
++                    result = self.replylist(rtypes[0], nodes)
++                    return (replyroot, result)
++                if len(nodes):
++                    unmarshaller = self.unmarshaller()
++                    resolved = rtypes[0].resolve(nobuiltin=True)
++                    result = unmarshaller.process(nodes[0], resolved)
++                    return (replyroot, result)
++        else:
++            # SOAP Error in a HTTP 200 OK message received - handle it!
++            unmarshaller = self.unmarshaller(False)
++            p = unmarshaller.process(fault)
++            if self.options().faults:
++                raise WebFault(p, replyroot)
++            return (replyroot, p.detail)
+         return (replyroot, None)
+     
+     def replylist(self, rt, nodes):

suds.hack-property-appending

+Hack for appending attributes as attributes
+
+diff -r 5da756c627f3 -r 1301367af63d suds/mx/appender.py
+--- a/suds/mx/appender.py	Mon Apr 19 10:48:13 2010 +0100
++++ b/suds/mx/appender.py	Mon Apr 19 10:48:56 2010 +0100
+@@ -305,6 +305,11 @@
+     """
+ 
+     def append(self, parent, content):
+-        child = self.node(content)
+-        child.setText(content.value)
+-        parent.append(child)
++        log.debug('appending using %s tag: %s type: %s\n', self.__class__.__name__, content.tag, content.type)
++        if content.tag.startswith('_'):
++            attr = content.tag[1:]
++            parent.set(attr, content.value)
++        else:
++            child = self.node(content)
++            child.setText(content.value)
++            parent.append(child)

suds.international

+Add international headers
+
+diff -r b8de404e59e5 suds/bindings/binding.py
+--- a/suds/bindings/binding.py	Tue Mar 16 11:12:45 2010 +0000
++++ b/suds/bindings/binding.py	Tue Mar 16 11:17:59 2010 +0000
+@@ -336,6 +336,11 @@
+         wsse = self.options().wsse
+         if wsse is not None:
+             content.append(wsse.xml())
++
++        i18n = self.options().i18n
++        if i18n is not None:
++            content.append(i18n.xml())
++
+         headers = self.options().soapheaders
+         if not isinstance(headers, (tuple,list,dict)):
+             headers = (headers,)
+@@ -508,4 +513,4 @@
+             return self
+         else:
+             return self.__resolved
+-    
+\ No newline at end of file
++    
+diff -r b8de404e59e5 suds/international.py
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/suds/international.py	Tue Mar 16 11:17:59 2010 +0000
+@@ -0,0 +1,69 @@
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the (LGPL) GNU Lesser General Public License as
++# published by the Free Software Foundation; either version 3 of the 
++# License, or (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU Library Lesser General Public License for more details at
++# ( http://www.gnu.org/licenses/lgpl.html ).
++#
++# You should have received a copy of the GNU Lesser General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++# written by: Jeff Ortel ( jortel@redhat.com )
++
++"""
++The I{i18n} module provides i18n support
++"""
++
++from logging import getLogger
++from suds import *
++from suds.sudsobject import Object
++from suds.sax.element import Element
++
++wsi18nns = \
++    ('ws',
++     'http://www.w3.org/2005/09/ws-i18n')
++wsi18nnss = \
++    ('ws', 
++     'http://www.w3.org/TR/ws-i18n/ws-i18n.xsd')
++
++
++class International(Object):
++    """
++    WS-Security object.
++    @ivar tokens: A list of security tokens
++    @type tokens: [L{Token},...]
++    @ivar signatures: A list of signatures.
++    @type signatures: TBD
++    @ivar references: A list of references.
++    @type references: TBD
++    @ivar keys: A list of encryption keys.
++    @type keys: TBD
++    """
++    
++    def __init__(self, locale = "", tz=None):
++        """ """
++        Object.__init__(self)
++        self.mustUnderstand = False
++        self.locale = locale
++        self.tz = tz
++        
++    def xml(self):
++        """
++        Get xml representation of the object.
++        @return: The root node.
++        @rtype: L{Element}
++        """
++        root = Element('international', ns=wsi18nns)
++        #root.set('mustUnderstand', str(self.mustUnderstand).lower())
++        l = Element('locale', ns=wsi18nns)
++        l.setText(self.locale)
++        root.append(l)
++        if self.tz is not None:
++            t = Element('tz', ns=wsi18nns)
++            t.setText(self.tz)
++            root.append(t)
++        return root
+diff -r b8de404e59e5 suds/options.py
+--- a/suds/options.py	Tue Mar 16 11:12:45 2010 +0000
++++ b/suds/options.py	Tue Mar 16 11:17:59 2010 +0000
+@@ -20,6 +20,7 @@
+ 
+ from suds.properties import *
+ from suds.wsse import Security
++from suds.international import International
+ from suds.xsd.doctor import Doctor
+ from suds.transport import Transport
+ from suds.cache import Cache, NoCache
+@@ -100,6 +101,7 @@
+             Definition('location', basestring, None),
+             Definition('soapheaders', (), ()),
+             Definition('wsse', Security, None),
++            Definition('i18n', International, None),
+             Definition('doctor', Doctor, None),
+             Definition('xstq', bool, True),
+             Definition('prefixes', bool, True),
+# HG changeset patch
+# User Michael Sommerville <msommerville@gmail.com>
+# Date 1271848925 -3600
+# Node ID d150981e1a0bc136096ae20186f05b2dd25b9bff
+# Parent 4f60b39105f62ddb3f30db22137213e4216984d8
+Local modifications
+
+diff -r 4f60b39105f6 .hgignore
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/.hgignore	Mon Oct 10 12:21:06 2011 +0100
+@@ -0,0 +1,5 @@
++syntax: glob
++*.pyc
++*.bak
++build\**
++*.rej
+diff -r 4f60b39105f6 suds/client.py
+--- a/suds/client.py	Mon Oct 10 12:20:21 2011 +0100
++++ b/suds/client.py	Mon Oct 10 12:21:06 2011 +0100
+@@ -707,7 +707,7 @@
+         status, reason = (error.httpcode, tostr(error))
+         reply = error.fp.read()
+         log.debug('http failed:\n%s', reply)
+-        if status == 500:
++        if status in (200,400,500):
+             if len(reply) > 0:
+                 r, p = binding.get_fault(reply)
+                 self.last_received(r)

suds.wsdl-namespace

+Use the soap namespace from the wsdl
+
+diff -r e1dc40270e23 suds/bindings/binding.py
+--- a/suds/bindings/binding.py	Tue Mar 16 11:17:59 2010 +0000
++++ b/suds/bindings/binding.py	Tue Mar 16 11:18:55 2010 +0000
+@@ -62,6 +62,10 @@
+         """
+         self.wsdl = wsdl
+         self.multiref = MultiRef()
++        self.envns = envns
++        ns = wsdl.root.nsprefixes.get('SOAP-ENV')
++        if ns:
++          self.envns = ('SOAP-ENV', ns)
+         
+     def schema(self):
+         return self.wsdl.schema
+@@ -291,7 +295,7 @@
+         @return: The soap envelope containing the body and header.
+         @rtype: L{Element}
+         """
+-        env = Element('Envelope', ns=envns)
++        env = Element('Envelope', ns=self.envns)
+         env.addPrefix(Namespace.xsins[0], Namespace.xsins[1])
+         env.append(header)
+         env.append(body)
+@@ -305,7 +309,7 @@
+         @return: the soap body fragment.
+         @rtype: L{Element}
+         """
+-        header = Element('Header', ns=envns)
++        header = Element('Header', ns=self.envns)
+         header.append(content)
+         return header
+     
+@@ -389,7 +393,7 @@
+         @return: the soap body fragment.
+         @rtype: L{Element}
+         """
+-        body = Element('Body', ns=envns)
++        body = Element('Body', ns=self.envns)
+         body.append(content)
+         return body
+