Changeset - 68764bdff7c9
[Not reviewed]
default
0 2 0
Mads Kiilerich - 10 years ago 2016-03-23 18:27:45
madski@unity3d.com
status: refactor internal dict for mapping status string to description

Slightly better performance ... but more importantly: do it "the right way".
2 files changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/helpers.py
Show inline comments
 
@@ -1438,7 +1438,7 @@ def changeset_status(repo, revision):
 

	
 

	
 
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):
kallithea/model/db.py
Show inline comments
 
@@ -2238,6 +2238,7 @@ class ChangesetStatus(Base, BaseModel):
 
        (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 @@ class ChangesetStatus(Base, BaseModel):
 

	
 
    @classmethod
 
    def get_status_lbl(cls, value):
 
        return dict(cls.STATUSES).get(value)
 
        return cls.STATUSES_DICT.get(value)
 

	
 
    @property
 
    def status_lbl(self):
0 comments (0 inline, 0 general)