Commits

Anonymous committed 3fc38c5

Fix duplicate DocumentPlugin.parsed() called when wsdl imports schema.

Comments (0)

Files changed (5)

 #
 
 __version__ = '0.4'
-__build__="(beta) R692-20100831"
+__build__="(beta) R693-20100901"
 
 #
 # Exceptions
     @type ctxclass: dict
     """
     
-    domain = {\
-        'init':InitContext,
-        'document':DocumentContext,
-        'message':MessageContext,
+    domains = {\
+        'init': (InitContext, InitPlugin),
+        'document': (DocumentContext, DocumentPlugin),
+        'message': (MessageContext, MessagePlugin ),
     }
     
     def __init__(self, plugins):
         self.plugins = plugins
     
     def __getattr__(self, name):
-        ctx = self.domain.get(name)
-        if ctx:
-            return PluginDomain(ctx, self.plugins)
+        domain = self.domains.get(name)
+        if domain:
+            plugins = []
+            ctx, pclass = domain
+            for p in self.plugins:
+                if isinstance(p, pclass):
+                    plugins.append(p)
+            return PluginDomain(ctx, plugins)
         else:
             raise Exception, 'plugin domain (%s), invalid' % name
         
 from suds.transport import Request
 from suds.cache import Cache, NoCache
 from suds.store import DocumentStore
+from suds.plugin import PluginContainer
 from logging import getLogger
 
 
         @type options: I{Options}
         """
         self.options = options
+        self.plugins = PluginContainer(options.plugins)
 
     def mangle(self, name, x):
         """
         if d is None:
             d = self.download(url)
             cache.put(id, d)
+        self.plugins.document.parsed(root=d.root())
         return d
     
     def download(self, url):
 from suds.xsd.query import ElementQuery
 from suds.sudsobject import Object, Facade, Metadata
 from suds.reader import DocumentReader, DefinitionsReader
-from suds.plugin import PluginContainer
 from urlparse import urljoin
 import re, soaparray
 
         reader = DocumentReader(options)
         d = reader.open(url)
         root = d.root()
-        plugins = PluginContainer(options.plugins)
-        plugins.document.parsed(root=root)
         WObject.__init__(self, root)
         self.id = objid(self)
         self.options = options

suds/xsd/schema.py

 tranparent referenced type resolution and targeted denormalization.
 """
 
-from logging import getLogger
+
 import suds.metrics
 from suds import *
 from suds.xsd import *
 from suds.xsd.deplist import DepList
 from suds.sax.element import Element
 from suds.sax import splitPrefix, Namespace
-from suds.plugin import PluginContainer
+from logging import getLogger
 
 log = getLogger(__name__)
 
         self.attributes = {}
         self.groups = {}
         self.agrps = {}
-        plugins = PluginContainer(options.plugins)
-        plugins.document.parsed(root=root)
         if options.doctor is not None:
             options.doctor.examine(root)
         form = self.root.get('elementFormDefault')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.