Part of twisted.persisted.styles View Source View In Hierarchy
Known subclasses: twisted.names.hosts.Resolver, twisted.python.components.Componentized, twisted.web.distrib.ResourcePublisher, twisted.web.static.File, twisted.web.static.Registry, twisted.words.im.basesupport.AbstractAccount
I have a single class attribute, the int persistenceVersion. After I am unserialized (and styles.doUpgrade() is called), self.upgradeToVersionX() will be called for each version upgrade I must undergo.
For example, if I serialize an instance of a Foo(Versioned) at version 4 and then unserialize it when the code is at version 9, the calls:
self.upgradeToVersion5() self.upgradeToVersion6() self.upgradeToVersion7() self.upgradeToVersion8() self.upgradeToVersion9()
will be made. If any of these methods are undefined, a warning message will be printed.
Method | __setstate__ | Undocumented |
Method | __getstate__ | Get state, adding a version number to it on its way out. |
Method | versionUpgrade | (internal) Do a version upgrade. |