def _setattr(self, key, value): if key in self._properties: #print "KEY", key # we want Model Properties to be set be set as actual attributes # because they can be real Python propertes or calculated values, # which are calcualted/set upon each save(). value = self._coerce_property_value(key, value) object.__setattr__(self, key, value) else: Element.__setattr__(self, key, value)
def _set_normal_attribute(self, key, value): """ Set normal/non-database Property attributes, depending on the __mode__. :param key: Attribute key :type key: str :param value: Attribute value :type value: object :rtype: None """ if self.__mode__ == STRICT: # Set as a Python attribute, which won't be saved to the database. object.__setattr__(self, key, value) else: # Store the attribute in self._data, which are saved to database. Element.__setattr__(self, key, value)