Skip to content

Commit

Permalink
Make Fault serializable as dict. arskom#158
Browse files Browse the repository at this point in the history
  • Loading branch information
plq committed Aug 6, 2012
1 parent 3924264 commit 849daa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spyne/model/fault.py
Expand Up @@ -42,3 +42,11 @@ def __repr__(self):
@classmethod @classmethod
def to_string_iterable(cls, value): def to_string_iterable(cls, value):
return [value.faultcode, '\n\n', value.faultstring] return [value.faultcode, '\n\n', value.faultstring]

@classmethod
def to_dict(cls, value):
return {cls.get_type_name(): {
"faultcode": value.faultcode,
"faultstring": value.faultstring,
"detail": value.detail,
}}
2 changes: 1 addition & 1 deletion spyne/protocol/_dictobj.py
Expand Up @@ -184,7 +184,7 @@ def serialize(self, ctx, message):
self.event_manager.fire_event('before_serialize', ctx) self.event_manager.fire_event('before_serialize', ctx)


if ctx.out_error is not None: if ctx.out_error is not None:
ctx.out_document = [ctx.out_error._to_dict(ctx.out_error)] ctx.out_document = [ctx.out_error.to_dict(ctx.out_error)]


else: else:
# get the result message # get the result message
Expand Down

0 comments on commit 849daa7

Please sign in to comment.