def get_attrs(self): from pvscore.model.core.attribute import Attribute return Attribute.find_values(self)
def set_attr(self, name, value): from pvscore.model.core.attribute import Attribute attr = Attribute.find(self.__class__.__name__, name) if not attr: attr = Attribute.create_new(self.__class__.__name__, name) attr.set(self, value)
def get_attr(self, name, default=None): from pvscore.model.core.attribute import Attribute attr = Attribute.find(self.__class__.__name__, name) if attr: return attr.get(self) return default
def clear_attributes(self): from pvscore.model.core.attribute import Attribute pkid = getattr(self, self.__pk__) if pkid: Attribute.clear_all(self.__class__.__name__, pkid)