Update old bug format in recheckwatch

When importing a pickled version of the old bug objects, they first need
to be converted to contain the duplicate_of attribute.

Change-Id: I59dbc27996d579aa7adc644c88c934236edd8623
This commit is contained in:
Joe Gordon 2013-09-11 17:14:25 -07:00
parent ed7b3a2f24
commit 151ade5298

View File

@ -112,8 +112,15 @@ class Scoreboard(threading.Thread):
# Import here because it needs to happen after daemonization
import gerritlib.gerrit
self.gerrit = gerritlib.gerrit.Gerrit(server, username, port, keyfile)
self._update_bug_format()
self.update()
def _update_bug_format(self):
for bugno, bug in self.scores.items():
if not hasattr(bug, 'duplicate_of'):
bug.duplicate_of = None
bug.update()
def _read(self, data):
if data.get('type', '') != 'comment-added':
return