summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjortel <devnull@localhost>2010-05-13 17:51:00 +0000
committerjortel <devnull@localhost>2010-05-13 17:51:00 +0000
commitf6d3973455da2526e5f4db57769babb167967045 (patch)
tree688f791901061d91dc6a4fea64ba8af6f782b48e
parent22468cdbf9c5448b20c4c098aad58fdce9886a81 (diff)
downloadsuds-f6d3973455da2526e5f4db57769babb167967045.tar.gz
Modified plugin API to: initialized(), loaded(), sending() & received().
-rw-r--r--suds/__init__.py2
-rw-r--r--suds/client.py6
-rw-r--r--suds/plugin.py18
-rw-r--r--suds/wsdl.py2
-rw-r--r--suds/xsd/doctor.py2
-rw-r--r--suds/xsd/schema.py2
-rw-r--r--tests/axis1.py14
7 files changed, 23 insertions, 23 deletions
diff --git a/suds/__init__.py b/suds/__init__.py
index c919937..4f4cdcd 100644
--- a/suds/__init__.py
+++ b/suds/__init__.py
@@ -27,7 +27,7 @@ import sys
#
__version__ = '0.4'
-__build__="(beta) R684-20100512"
+__build__="(beta) R685-20100513"
#
# Exceptions
diff --git a/suds/client.py b/suds/client.py
index d492fff..0bdde6f 100644
--- a/suds/client.py
+++ b/suds/client.py
@@ -111,7 +111,7 @@ class Client(object):
reader = DefinitionsReader(options, Definitions)
self.wsdl = reader.open(url)
plugins = PluginContainer(options.plugins)
- plugins.onInit(wsdl=self.wsdl)
+ plugins.initialized(wsdl=self.wsdl)
self.factory = Factory(self.wsdl)
self.service = ServiceSelector(self, self.wsdl.services)
self.sd = []
@@ -624,7 +624,7 @@ class SoapClient:
try:
self.last_sent(Document(msg))
plugins = PluginContainer(self.options.plugins)
- plugins.onSend(envelope=msg.root())
+ plugins.sending(envelope=msg.root())
request = Request(location, str(msg))
request.headers = self.headers()
reply = transport.send(request)
@@ -663,7 +663,7 @@ class SoapClient:
"""
log.debug('http succeeded:\n%s', reply)
plugins = PluginContainer(self.options.plugins)
- ctx = plugins.onReply(reply=reply)
+ ctx = plugins.received(reply=reply)
reply = ctx.reply
if len(reply) > 0:
r, p = binding.get_reply(self.method, reply)
diff --git a/suds/plugin.py b/suds/plugin.py
index bc8071f..ca0826f 100644
--- a/suds/plugin.py
+++ b/suds/plugin.py
@@ -76,7 +76,7 @@ class Plugin:
All plugins should implement this interface.
"""
- def onInit(self, context):
+ def initialized(self, context):
"""
Suds initialization.
Called after wsdl the has been loaded. Provides the plugin
@@ -86,7 +86,7 @@ class Plugin:
"""
pass
- def onLoad(self, context):
+ def loaded(self, context):
"""
Suds has loaded an XSD document. Provides the plugin
with an opportunity to inspect/modify the loaded XSD.
@@ -96,7 +96,7 @@ class Plugin:
"""
pass
- def onSend(self, context):
+ def sending(self, context):
"""
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
@@ -106,7 +106,7 @@ class Plugin:
"""
pass
- def onReply(self, context):
+ def received(self, context):
"""
Suds has received the specified reply.
Provides the plugin with the opportunity to inspect/modify
@@ -127,10 +127,10 @@ class PluginContainer:
"""
ctxclass = {\
- 'onInit':InitContext,
- 'onLoad':LoadContext,
- 'onSend':SendContext,
- 'onReply':ReplyContext,
+ 'initialized':InitContext,
+ 'loaded':LoadContext,
+ 'sending':SendContext,
+ 'received':ReplyContext,
}
def __init__(self, plugins):
@@ -141,7 +141,7 @@ class PluginContainer:
self.plugins = plugins
def __getattr__(self, name):
- ctx = self.ctxclass.get(name, Context)
+ ctx = self.ctxclass.get(name)
if ctx:
return Method(name, ctx, self.plugins)
else:
diff --git a/suds/wsdl.py b/suds/wsdl.py
index 7c89fa9..0400e9b 100644
--- a/suds/wsdl.py
+++ b/suds/wsdl.py
@@ -137,7 +137,7 @@ class Definitions(WObject):
d = reader.open(url)
root = d.root()
plugins = PluginContainer(options.plugins)
- plugins.onLoad(root=root)
+ plugins.loaded(root=root)
WObject.__init__(self, root)
self.id = objid(self)
self.options = options
diff --git a/suds/xsd/doctor.py b/suds/xsd/doctor.py
index 857dc99..63271dc 100644
--- a/suds/xsd/doctor.py
+++ b/suds/xsd/doctor.py
@@ -212,7 +212,7 @@ class ImportDoctor(Doctor, Plugin):
for imp in self.imports:
imp.apply(root)
- def onLoad(self, context):
+ def loaded(self, context):
root = context.root
if Namespace.xsd(root.namespace()):
self.examine(root)
diff --git a/suds/xsd/schema.py b/suds/xsd/schema.py
index f2aedfa..912fb03 100644
--- a/suds/xsd/schema.py
+++ b/suds/xsd/schema.py
@@ -215,7 +215,7 @@ class Schema:
self.groups = {}
self.agrps = {}
plugins = PluginContainer(options.plugins)
- plugins.onLoad(root=root)
+ plugins.loaded(root=root)
if options.doctor is not None:
options.doctor.examine(root)
form = self.root.get('elementFormDefault')
diff --git a/tests/axis1.py b/tests/axis1.py
index 3ae3225..2206d02 100644
--- a/tests/axis1.py
+++ b/tests/axis1.py
@@ -40,17 +40,17 @@ setup_logging()
class TestPlugin(Plugin):
- def onInit(self, context):
- print 'init: ctx=%s' % context.__dict__
+ def initialized(self, context):
+ print 'initialized: ctx=%s' % context.__dict__
- def onLoad(self, context):
- print 'loading: ctx=%s' % context.__dict__
+ def loaded(self, context):
+ print 'loaded: ctx=%s' % context.__dict__
- def onSend(self, context):
+ def sending(self, context):
print 'sending: ctx=%s' % context.__dict__
- def onReply(self, context):
- print 'gotreply: ctx=%s' % context.__dict__
+ def received(self, context):
+ print 'received: ctx=%s' % context.__dict__
#logging.getLogger('suds.client').setLevel(logging.DEBUG)