diff rhodecode/model/db.py @ 2481:4d3032431d4f beta

Adde pull request voting recalculation
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 19 Jun 2012 00:43:55 +0200
parents cb9e73b29a87
children fddd8e3fc157
line wrap: on
line diff
--- a/rhodecode/model/db.py	Mon Jun 18 21:31:03 2012 +0200
+++ b/rhodecode/model/db.py	Tue Jun 19 00:43:55 2012 +0200
@@ -1371,14 +1371,17 @@
         {'extend_existing': True, 'mysql_engine': 'InnoDB',
          'mysql_charset': 'utf8'}
     )
+    STATUS_NOT_REVIEWED = DEFAULT = 'not_reviewed'
+    STATUS_APPROVED = 'approved'
+    STATUS_REJECTED = 'rejected'
+    STATUS_UNDER_REVIEW = 'under_review'
 
     STATUSES = [
-        ('not_reviewed', _("Not Reviewed")),  # (no icon) and default
-        ('approved', _("Approved")),
-        ('rejected', _("Rejected")),
-        ('under_review', _("Under Review")),
+        (STATUS_NOT_REVIEWED, _("Not Reviewed")),  # (no icon) and default
+        (STATUS_APPROVED, _("Approved")),
+        (STATUS_REJECTED, _("Rejected")),
+        (STATUS_UNDER_REVIEW, _("Under Review")),
     ]
-    DEFAULT = STATUSES[0][0]
 
     changeset_status_id = Column('changeset_status_id', Integer(), nullable=False, primary_key=True)
     repo_id = Column('repo_id', Integer(), ForeignKey('repositories.repo_id'), nullable=False)
@@ -1395,6 +1398,12 @@
     comment = relationship('ChangesetComment', lazy='joined')
     pull_request = relationship('PullRequest', lazy='joined')
 
+    def __unicode__(self):
+        return u"<%s('%s:%s')>" % (
+            self.__class__.__name__,
+            self.status, self.author
+        )
+
     @classmethod
     def get_status_lbl(cls, value):
         return dict(cls.STATUSES).get(value)