a way to automatically create simple attributes
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index cb33c2f..7ef26c9 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -29,6 +29,14 @@
attributes = {}
return attributes.get(name, default)
+ @classmethod
+ def setup_simple_attributes(cls):
+ for (attrname, default) in cls.simple_attributes:
+ setattr(cls, attrname, property(lambda self: self.get_attribute(attrname, default),
+ lambda self, value: self.set_attribute(attrname, value),
+ None,
+ attrname))
+
class Service(PlCoreBase, AttributeMixin):
# when subclassing a service, redefine KIND to describe the new service
KIND = "generic"