Permalink
Browse files

Make Fault serializable as dict. #158

  • Loading branch information...
1 parent 3924264 commit 849daa767e06e9155c128c4a53be6b359a42cc15 @plq committed Aug 6, 2012
Showing with 9 additions and 1 deletion.
  1. +8 −0 spyne/model/fault.py
  2. +1 −1 spyne/protocol/_dictobj.py
@@ -42,3 +42,11 @@ def __repr__(self):
@classmethod
def to_string_iterable(cls, value):
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,
+ }}
@@ -184,7 +184,7 @@ def serialize(self, ctx, message):
self.event_manager.fire_event('before_serialize', ctx)
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:
# get the result message

0 comments on commit 849daa7

Please sign in to comment.