[ZODB-Dev] ZODB Object evolution and class variables ?

Andreas Martin a.martin@perfectwww.de
Mon, 4 Nov 2002 22:54:27 +0100


Hallo !

I'm a Zopenewbie and just experimenting with own Zope Python products
and I don't know whether this is the rigt place to post my question. 

I created a sample News Product that should automatically set the id of
a new instance to an autogenerated number.

The class looks like this:

class News(SimpleItem):
    "A News object"

    meta_type = "News"

    actualKey = 0

    def __init__(self, teaser):
        self.key          = News.actualKey
        News.actualKey   += 1
        self.id           = str(self.key)
        self.teaser       = teaser

That's ok but when I change the class definition I have the problem that
my class variable "actualkey" starts again by 0.

I managed to add new instance attributes like "teaser" and a
__setstate__ function is working fine.

My only problem is the global class variable, that is changed to 0 when
I refresh my product in the zope management interface.

Thanks for help