[devel at bb.net] Adding attribute to serialized objects
Dustin J. Mitchell
dustin at v.igoro.us
Fri Jan 29 14:43:29 UTC 2016
That's tricky -- once you load and re-save a pickle with persistence
version N, code that doesn't have that version defined (older code) will
not be able to load the pickle. So you'll need to apply the patch to all
Pickles are no fun :(
On Tue, Jan 26, 2016 at 4:04 AM, Maria Marcano <mariangemarcano at gmail.com>
> Do you know how we should handle adding an attribute to serialized object.
> We are doing some customizations and we would like to add content_type to
> class HTMLLogFile(styles.Versioned, LogFile):
> so we increased the
> persistenceVersion = 2
> and added the
> def upgradeToVersion2(self):
> self.content_type = ''
> self.wasUpgraded = True
> But we got an error if we want to run buildbot on a different branch that
> uses persistenceVersion = 1
> the exception is thrown from this library
> twisted/persisted/styles.py:400 in versionUpgrade
> assert persistVers <= currentVers, "Sorry, can't go backwards in time."
> Do you know how this should be handled?, it looks like we are missing/not
> handle something?
> devel mailing list
> devel at buildbot.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the devel