# HG changeset patch # User Mads Kiilerich # Date 1458754065 -3600 # Node ID 68764bdff7c9f36db6a3627acca70416757562e9 # Parent 2824cb8bcc0ec2ecd333038f206417e0ba3a5174 status: refactor internal dict for mapping status string to description Slightly better performance ... but more importantly: do it "the right way". diff -r 2824cb8bcc0e -r 68764bdff7c9 kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py Wed Mar 23 18:27:45 2016 +0100 +++ b/kallithea/lib/helpers.py Wed Mar 23 18:27:45 2016 +0100 @@ -1438,7 +1438,7 @@ def changeset_status_lbl(changeset_status): - return dict(ChangesetStatus.STATUSES).get(changeset_status) + return ChangesetStatus.get_status_lbl(changeset_status) def get_permission_name(key): diff -r 2824cb8bcc0e -r 68764bdff7c9 kallithea/model/db.py --- a/kallithea/model/db.py Wed Mar 23 18:27:45 2016 +0100 +++ b/kallithea/model/db.py Wed Mar 23 18:27:45 2016 +0100 @@ -2238,6 +2238,7 @@ (STATUS_REJECTED, _("Rejected")), (STATUS_UNDER_REVIEW, _("Under review")), ] + STATUSES_DICT = dict(STATUSES) changeset_status_id = Column(Integer(), unique=True, primary_key=True) repo_id = Column(Integer(), ForeignKey('repositories.repo_id'), nullable=False) @@ -2262,7 +2263,7 @@ @classmethod def get_status_lbl(cls, value): - return dict(cls.STATUSES).get(value) + return cls.STATUSES_DICT.get(value) @property def status_lbl(self):