def __setattr__(self, k, v): if k.startswith('_'): object.__setattr__(self, k, v) else: if isinstance(v, FunctionType): v = Lazy(v) elif isinstance(v, DatumBase): # implicit many_to_one v = many_to_one(v, k, v._tableau_id_fields) elif is_iterable_container(v): # implicit one_to_many v = one_to_many(v, k) if isinstance(v, DynamicField): v.bind(self, k) if isinstance(v, many_to_one): for _k in v.this_side_fields: self.__check_key_is_declared(_k) elif isinstance(v, one_to_many): self.__check_key_is_declared(k) if v.referred_fields is not None: for _k in v.referred_fields: self.__check_key_is_declared(_k) object.__getattribute__(self, '_tableau_fields')[k] = v if self._tableau_managed_class is not None and not isinstance(v, Lazy): object.__setattr__(self, k, self._value_of(k, v))
def __setattr__(self, k, v): if k.startswith('_'): object.__setattr__(self, k, v) else: if isinstance(v, FunctionType): v = Lazy(v) elif isinstance(v, DatumBase): # implicit many_to_one v = many_to_one(v, k, v._tableau_id_fields) elif is_iterable_container(v): # implicit one_to_many v = one_to_many(v, k) if isinstance(v, DynamicField): v.bind(self, k) if isinstance(v, many_to_one): for _k in v.this_side_fields: self.__check_key_is_declared(_k) elif isinstance(v, one_to_many): self.__check_key_is_declared(k) if v.referred_fields is not None: for _k in v.referred_fields: self.__check_key_is_declared(_k) object.__getattribute__(self, '_tableau_fields')[k] = v if self._tableau_managed_class is not None and not isinstance( v, Lazy): object.__setattr__(self, k, self._value_of(k, v))
def __setattr__(self, k, v): if k.startswith('_'): object.__setattr__(self, k, v) else: if isinstance(v, FunctionType): v = Lazy(v) elif isinstance(v, DatumBase): # implicit many_to_one v = many_to_one(v, k, v._tableau_id_fields) elif is_iterable_container(v): # implicit one_to_many v = one_to_many(v, k) if isinstance(v, DynamicField): v.bind(self, k) self._tableau_fields[k] = v