Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: pending_manager.py

Issue 11414143: Change models.py to use typed class members instead of a list of strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/commit-queue
Patch Set: More doc, minor fixes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pending_manager.py
diff --git a/pending_manager.py b/pending_manager.py
index 983cc06088ebd5302865b0d56df75afabb770b2c..d557627b07c7257b893d08728a2013a6732b58a3 100644
--- a/pending_manager.py
+++ b/pending_manager.py
@@ -31,38 +31,30 @@ from verification import base
class PendingCommit(base.Verified):
"""Represents a pending commit that is being processed."""
- persistent = base.Verified.persistent + [
- # Important since they tell if we need to revalidate and send try jobs
- # again or not if any of these value changes.
- 'issue', 'patchset', 'description', 'files',
- # Only a cache, these values can be regenerated.
- 'owner', 'reviewers', 'base_url', 'messages', 'relpath',
- # Only used after a patch was committed. Keeping here for try job retries.
- 'revision',
- ]
-
- def __init__(
- self, issue, owner, reviewers, patchset, base_url, description,
- messages):
- super(PendingCommit, self).__init__()
- self.issue = issue
- self.owner = owner
- self.reviewers = reviewers
- self.patchset = patchset
- self.base_url = base_url
- self.description = description
- # Convert to unicode whenever necessary.
- if isinstance(self.description, str):
- self.description = self.description.decode('utf-8')
- assert isinstance(self.description, unicode)
- self.messages = messages
+ # Important since they tell if we need to revalidate and send try jobs
+ # again or not if any of these value changes.
+ issue = int
+ patchset = int
+ description = unicode
+ files = list
+ # Only a cache, these values can be regenerated.
+ owner = str
+ reviewers = list
+ base_url = str
+ messages = list
+ relpath = str
+ # Only used after a patch was committed. Keeping here for try job retries.
+ revision = (None, int, str)
+
+ def __init__(self, description, **kwargs):
+ # Convert description to unicode whenever necessary.
+ if isinstance(description, str):
+ description = description.decode('utf-8')
+ super(PendingCommit, self).__init__(description=description, **kwargs)
for message in self.messages:
# Save storage, no verifier really need 'text', just 'approval'.
if 'text' in message:
del message['text']
- self.revision = None
- self.relpath = ''
- self.files = []
def pending_name(self):
"""The name that should be used for try jobs.
@@ -110,11 +102,7 @@ class PendingCommit(base.Verified):
class PendingQueue(model.PersistentMixIn):
"""Represents the queue of pending commits being processed."""
- persistent = ['pending_commits']
-
- def __init__(self):
- super(PendingQueue, self).__init__()
- self.pending_commits = []
+ pending_commits = list
class PendingManager(object):

Powered by Google App Engine
This is Rietveld 408576698