Commits

daevaorn  committed f67d9d9

Refactor of tiny server

  • Participants
  • Parent commits 59e3851

Comments (0)

Files changed (1)

File suds/server.py

-from suds.wsdl import Definitions
-from suds.options import Options
-from suds.transport.https import HttpAuthenticated
-from suds.transport.cache import FileCache
-from suds.properties import Unskin
-from suds.client import Factory
 
 class Server(object):
-    def __init__(self, wsdl_source, binding=None, **options):
-        self.options = Options()
-        self.options.transport = HttpAuthenticated()
-        self.options.cache = FileCache(days=1)
-        self.set_options(**options)
-
-        self.wsdl = Definitions(wsdl_source, self.options)
-
-        self.factory = Factory(self.wsdl)
+    def __init__(self, client, binding=None):
+        self.wsdl = client.wsdl
+        self.factory = client.factory
 
         def get_binding(obj):
             return self.wsdl.bindings_def['%s/literal' % obj.soap.style] # assume literal use
             else:
                 raise ValueError('Binding name required')
 
-    def set_options(self, **kwargs):
-        """
-        Set options.
-        @param kwargs: keyword arguments.
-        @see: L{Options}
-        """
-        p = Unskin(self.options)
-        p.update(kwargs)
-
     def handle_request(self, content):
         replyroot = self.binding.parser.parse(string=content)