Lorenzo Gil Sánchez wrote:
I've been using a zope.app.generations.interfaces.ISchemaManager to keep
my database up to date with respect to the changes in the models of my
application and everything is well so far.
Now I have a tricky situation. My model had an attribute and now I
changed that attribute to be read only.
attr1 = zope.schema.TextLine()
def __init__(self, attr1=None):
self.attr1 = attr1
attr1 = zope.schema.TextLine(readonly=True)
attr2 = zope.schema.TextLine()
def __init__(self, attr2=None):
self.attr2 = attr2
attr1 = property(_getAttr1)
As you can see, now attr1 is a computed attribute from attr2.
When updating the old Model objects I add the 'attr2' attribute but I
can't remove the old 'attr1' attribute since is still defined in Model
but is a totally different thing.
I can forget about removing the 'attr1' attribute and things keep
working well. The problem is a waste of space in the database since that
information is still there but impossible to retrieve, right?
I have a related question: is attr1 still saved in the database in the
newer version no matter is a read only python property or does the ZODB
handle this case? As far as I know ZODB only skip those attributes
beginning with _v_ (for volatile), but don't know what it does with
Has anyone ever reached a similar situation? Any solution?
You can do this on your instance :
Zope3-users mailing list