Guest User

Untitled

a guest
Mar 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. def serializable(cls):
  2. class wrapper:
  3. def __init__(self, *args):
  4. self.wrapped = cls(*args)
  5. def __getattr__(self, *args):
  6. return getattr(self.wrapped, *args)
  7. def serialize(self):
  8. return jsonpickle.encode(self.wrapped)
  9. @staticmethod
  10. def deserialize(ser_str):
  11. return jsonpickle.decode(ser_str)
  12. return wrapper
Add Comment
Please, Sign In to add comment