diff --git a/goblin/element.py b/goblin/element.py index a141bf8ee80190e0e3ba202bc4796681067bbab1..d69854b9906713370b5421812872d2cfeec33926 100644 --- a/goblin/element.py +++ b/goblin/element.py @@ -66,6 +66,14 @@ class ElementMeta(type): class Element(metaclass=ElementMeta): """Base class for classes that implement the Element property interface""" + def __init__(self, **kwargs): + for key, value in kwargs.items(): + if not (hasattr(self, key) and + isinstance(getattr(self, key), properties.PropertyDescriptor)): + raise AssertionError( + "No such property: {} for element {}".format(key, self.__class__.__name__)) + setattr(self, key, value) + id = properties.IdProperty(properties.Generic)