Changeset 18:40ba502fe87e in mailjam
- Timestamp:
- May 22, 2012, 1:26:27 PM (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mailjam/storage.py
r16 r18 11 11 """ 12 12 13 import os, errno, json 13 import os, errno, json, inspect 14 14 15 15 … … 63 63 module = __import__(module_name) 64 64 class_ = getattr(module, class_name) 65 # inspect the class __init__ method, getting a list of 66 # accepted/valid arguments. 67 valid_args = inspect.getargspec(class_.__init__) 68 # then, only accepted parameters will be deserialized 65 69 args = dict((key.encode('ascii'), value) \ 66 for key, value in jobj.items() )70 for key, value in jobj.items() if key in valid_args[0]) 67 71 return class_(**args) 68 72 return jobj
Note:
See TracChangeset
for help on using the changeset viewer.