Skip to content

Commit

Permalink
add missing event firings to client and server transport base classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
plq committed Sep 12, 2011
1 parent 4953b9a commit 0f45d7d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
23 changes: 23 additions & 0 deletions src/rpclib/client/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,28 @@ def get_out_string(self):
assert self.ctx.out_string is None

self.app.out_protocol.serialize(self.ctx)

if self.ctx.service_class != None:
if self.ctx.out_error is None:
self.ctx.service_class.event_manager.fire_event(
'method_return_document', self.ctx)
else:
self.ctx.service_class.event_manager.fire_event(
'method_exception_document', self.ctx)

self.app.out_protocol.create_out_string(self.ctx, string_encoding)

if self.ctx.service_class != None:
if self.ctx.out_error is None:
self.ctx.service_class.event_manager.fire_event(
'method_return_string', self.ctx)
else:
self.ctx.service_class.event_manager.fire_event(
'method_exception_string', self.ctx)

if self.ctx.out_string is None:
self.ctx.out_string = [""]

def get_in_object(self):
"""Deserializes the response bytestream to input document and native
python object.
Expand All @@ -112,6 +132,9 @@ def get_in_object(self):
assert self.ctx.in_document is None

self.app.in_protocol.create_in_document(self.ctx)
if self.ctx.service_class != None:
self.ctx.service_class.event_manager.fire_event(
'method_accept_document', self.ctx)

# sets the ctx.in_body_doc and ctx.in_header_doc properties
self.app.in_protocol.decompose_incoming_envelope(self.ctx)
Expand Down
10 changes: 6 additions & 4 deletions src/rpclib/server/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ def get_in_object(self, ctx, in_string_charset=None):
to set ctx.in_object."""

self.app.in_protocol.create_in_document(ctx, in_string_charset)
if ctx.service_class != None:
ctx.service_class.event_manager.fire_event('method_accept_document',ctx)

try:
# sets the ctx.in_body_doc and ctx.in_header_doc properties
# sets the ctx.in_body_doc and ctx.in_header_doc
self.app.in_protocol.decompose_incoming_envelope(ctx)

if ctx.service_class != None:
ctx.service_class.event_manager.fire_event('decompose_envelope',
ctx)
# sets the ctx.in_object and ctx.in_header
self.app.in_protocol.deserialize(ctx)

except Fault,e:
Expand All @@ -68,6 +68,8 @@ def get_out_object(self, ctx):
"""Calls the matched method using the ctx.in_object to get
ctx.out_object."""


# event firing is done in the rpclib.application.Application
self.app.process_request(ctx)

def get_out_string(self, ctx):
Expand Down

0 comments on commit 0f45d7d

Please sign in to comment.