diff options
Diffstat (limited to 'pandora/models/__init__.py')
-rw-r--r-- | pandora/models/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pandora/models/__init__.py b/pandora/models/__init__.py index 141a64b..7a60889 100644 --- a/pandora/models/__init__.py +++ b/pandora/models/__init__.py | |||
@@ -39,8 +39,7 @@ class SyntheticField(namedtuple("SyntheticField", ["field"])): | |||
39 | payload. | 39 | payload. |
40 | """ | 40 | """ |
41 | 41 | ||
42 | @staticmethod | 42 | def formatter(self, api_client, data, newval): # pragma: no cover |
43 | def formatter(api_client, field, data): # pragma: no cover | ||
44 | """Format Value for Model | 43 | """Format Value for Model |
45 | 44 | ||
46 | The return value of this method is used as a value for the field in the | 45 | The return value of this method is used as a value for the field in the |
@@ -51,6 +50,9 @@ class SyntheticField(namedtuple("SyntheticField", ["field"])): | |||
51 | data | 50 | data |
52 | complete JSON data blob for the parent model of which this field is | 51 | complete JSON data blob for the parent model of which this field is |
53 | a member | 52 | a member |
53 | newval | ||
54 | the value of this field as retrieved from the JSON data after | ||
55 | having resolved default value logic | ||
54 | """ | 56 | """ |
55 | raise NotImplementedError | 57 | raise NotImplementedError |
56 | 58 | ||
@@ -119,7 +121,7 @@ class PandoraModel(with_metaclass(ModelMetaClass, object)): | |||
119 | newval = data.get(value.field, default) | 121 | newval = data.get(value.field, default) |
120 | 122 | ||
121 | if isinstance(value, SyntheticField): | 123 | if isinstance(value, SyntheticField): |
122 | newval = value.formatter(api_client, value.field, data, newval) | 124 | newval = value.formatter(api_client, data, newval) |
123 | setattr(instance, key, newval) | 125 | setattr(instance, key, newval) |
124 | continue | 126 | continue |
125 | 127 | ||