summaryrefslogtreecommitdiff
path: root/suds/xsd
diff options
context:
space:
mode:
authorjortel <devnull@localhost>2010-05-11 20:44:48 +0000
committerjortel <devnull@localhost>2010-05-11 20:44:48 +0000
commit02ad8ec61d3ed548dda7455e1f7c298df7b820bb (patch)
tree99db5bd9b48a7e7ab7c9641da7cc6c8d5009fee4 /suds/xsd
parent1c30aa44c270626740c713b22371cd1ffc230c54 (diff)
downloadsuds-02ad8ec61d3ed548dda7455e1f7c298df7b820bb.tar.gz
Add Plugins facility. Supports hooks for onInit(), onLoad(), onSend() onReply() events.
Diffstat (limited to 'suds/xsd')
-rw-r--r--suds/xsd/doctor.py10
-rw-r--r--suds/xsd/schema.py7
2 files changed, 12 insertions, 5 deletions
diff --git a/suds/xsd/doctor.py b/suds/xsd/doctor.py
index 84c9151..2ac3521 100644
--- a/suds/xsd/doctor.py
+++ b/suds/xsd/doctor.py
@@ -22,6 +22,7 @@ schema(s).
from logging import getLogger
from suds.sax import splitPrefix, Namespace
from suds.sax.element import Element
+from suds.plugin import Plugin
log = getLogger(__name__)
@@ -186,7 +187,7 @@ class Import:
return 0
-class ImportDoctor(Doctor):
+class ImportDoctor(Doctor, Plugin):
"""
Doctor used to fix missing imports.
@ivar imports: A list of imports to apply.
@@ -210,3 +211,10 @@ class ImportDoctor(Doctor):
def examine(self, root):
for imp in self.imports:
imp.apply(root)
+
+ def onLoad(self, context):
+ root = context.root
+ if root.get('name') == 'schema':
+ self.examine(root)
+ else:
+ pass \ No newline at end of file
diff --git a/suds/xsd/schema.py b/suds/xsd/schema.py
index 4194673..f2aedfa 100644
--- a/suds/xsd/schema.py
+++ b/suds/xsd/schema.py
@@ -33,6 +33,7 @@ from suds.xsd.sxbase import SchemaObject
from suds.xsd.deplist import DepList
from suds.sax.element import Element
from suds.sax import splitPrefix, Namespace
+from suds.plugin import PluginContainer
log = getLogger(__name__)
@@ -168,10 +169,6 @@ class Schema:
@type container: L{SchemaCollection}
@ivar children: A list of direct top level children.
@type children: [L{SchemaObject},...]
- @ivar all: A children.
- @type all: [L{SchemaObject},...]
- @ivar groups: A schema groups cache.
- @type groups: {name:L{SchemaObject}}
@ivar all: A list of all (includes imported) top level children.
@type all: [L{SchemaObject},...]
@ivar types: A schema types cache.
@@ -217,6 +214,8 @@ class Schema:
self.attributes = {}
self.groups = {}
self.agrps = {}
+ plugins = PluginContainer(options.plugins)
+ plugins.onLoad(root=root)
if options.doctor is not None:
options.doctor.examine(root)
form = self.root.get('elementFormDefault')