76 """Transforms the input class cls so the only attributes which can be set are the lproperty of the class.
77 Best used as a decorator. Ex :
78 @onlyAttributesAreProperties
80 myprop0 = make_lproperty('myprop0')
84 a.mypropO = 3 # impossible
90 cls._allowedattributes += [
'_locked']
93 cls._nomoreattributes=
False
96 cls.__init__origin = cls.__init__
100 def initwraper(self, *l,finalinit=True, **args):
101 cls.__init__origin(self, *l,**args)
102 self._nomoreattributes = finalinit
103 cls.__init__ = initwraper
106 def setattr(self, k, v):
107 if self._nomoreattributes
and k
not in self._allowedattributes:
108 raise AttributeError(
"Setting attribute "+k+
" on "+str(self)+
" not allowed")
110 cls.__setattr__ = setattr