|
18 | 18 | from __future__ import absolute_import |
19 | 19 |
|
20 | 20 | from .cell_link import CellLink |
| 21 | +from .explicit_null import ExplicitNull |
21 | 22 | from .hyperlink import Hyperlink |
22 | 23 | from .image import Image |
23 | | -from .object_value import * |
24 | | -from .duration import Duration |
25 | | -from .predecessor_list import PredecessorList |
26 | | -from .contact_object_value import ContactObjectValue |
27 | | -from .multi_contact_object_value import MultiContactObjectValue |
28 | | -from .date_object_value import DateObjectValue |
29 | | -from .string_object_value import StringObjectValue |
30 | | -from .number_object_value import NumberObjectValue |
31 | | -from .boolean_object_value import BooleanObjectValue |
| 24 | +from ..object_value import assign_to_object_value |
32 | 25 | from ..types import * |
33 | 26 | from ..util import serialize |
34 | 27 | from ..util import deserialize |
@@ -162,36 +155,7 @@ def object_value(self): |
162 | 155 |
|
163 | 156 | @object_value.setter |
164 | 157 | def object_value(self, value): |
165 | | - if isinstance(value, ObjectValue): |
166 | | - self._object_value = value |
167 | | - elif isinstance(value, dict): |
168 | | - object_type = value['objectType'] |
169 | | - if object_type in OBJECT_VALUE['object_type']: |
170 | | - enum_object_type = enum_object_value_type(object_type) |
171 | | - if enum_object_type == DURATION: |
172 | | - self._object_value = Duration(value, self._base) |
173 | | - elif enum_object_type == PREDECESSOR_LIST: |
174 | | - self._object_value = PredecessorList(value, self._base) |
175 | | - elif enum_object_type == CONTACT: |
176 | | - self._object_value = ContactObjectValue(value, self._base) |
177 | | - elif enum_object_type == DATE or enum_object_type == DATETIME or \ |
178 | | - enum_object_type == ABSTRACT_DATETIME: |
179 | | - self._object_value = DateObjectValue(value, enum_object_value_type, self._base) |
180 | | - elif enum_object_type == MULTI_CONTACT: |
181 | | - self._object_value = MultiContactObjectValue(value, self._base) |
182 | | - else: |
183 | | - self._object_value = None |
184 | | - else: |
185 | | - raise ValueError( |
186 | | - ("`{0}` is an invalid value for ObjectValue`object_type`," |
187 | | - " must be one of {1}").format( |
188 | | - object_type, OBJECT_VALUE['object_type'])) |
189 | | - elif isinstance(value, six.string_types): |
190 | | - self._object_value = StringObjectValue(value) |
191 | | - elif isinstance(value, (six.integer_types, float)): |
192 | | - self._object_value = NumberObjectValue(value) |
193 | | - elif isinstance(value, bool): |
194 | | - self._object_value = BooleanObjectValue(value) |
| 158 | + self._object_value = assign_to_object_value(value) |
195 | 159 |
|
196 | 160 | @property |
197 | 161 | def override_validation(self): |
|
0 commit comments