diff --git a/secop/params.py b/secop/params.py index 4bd9541..f32068d 100644 --- a/secop/params.py +++ b/secop/params.py @@ -63,15 +63,8 @@ class Accessible(HasProperties, CountedObj): return type(self)(**props) def for_export(self): - # used for serialisation only - # some specials: - # - datatype needs a special serialisation - # - readonly is mandatory for serialisation, but not for declaration in classes - r = self.exportProperties() - if isinstance(self, Parameter): - if 'readonly' not in r: - r['readonly'] = self.__class__.properties['readonly'].default - return r + """prepare for serialisation""" + return self.exportProperties() class Parameter(Accessible): @@ -181,6 +174,16 @@ class Parameter(Accessible): super().checkProperties() self.datatype.checkProperties() + def for_export(self): + """prepare for serialisation + + readonly is mandatory for serialisation, but not for declaration in classes + """ + r = super().for_export() + if 'readonly' not in r: + r['readonly'] = self.__class__.properties['readonly'].default + return r + class UnusedClass: # do not derive anything from this! @@ -300,20 +303,6 @@ class Command(Accessible): def result(self): return self.datatype.result - def for_export(self): - # used for serialisation only - # some specials: - # - datatype needs a special serialisation - # - readonly is mandatory for serialisation, but not for declaration in classes - r = self.exportProperties() -# if isinstance(self, Parameter): -# if 'readonly' not in r: -# r['readonly'] = self.__class__.properties['readonly'].default -# if 'datatype' in r: -# _d = r['datatype'] -# print(formatExtendedStack()) # for debug - return r - # list of predefined accessibles with their type PREDEFINED_ACCESSIBLES = dict(