Changeset - 319b16518227
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-02-11 03:05:00
madski@unity3d.com
db: check for None instead of boolean false if that is what we mean

If matters a lot whether we find all comments for the specified empty list of
changesets or for None meaning the whole repository.
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/model/db.py
Show inline comments
 
@@ -1219,13 +1219,13 @@ class Repository(Base, BaseModel):
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
 
    @classmethod
 
    def lock(cls, repo, user_id, lock_time=None):
 
        if not lock_time:
 
        if lock_time is not None:
 
            lock_time = time.time()
 
        repo.locked = [user_id, lock_time]
 
        Session().add(repo)
 
        Session().commit()
 

	
 
    @classmethod
 
@@ -1355,13 +1355,13 @@ class Repository(Base, BaseModel):
 
        Returns comments for this repository grouped by revisions
 

	
 
        :param revisions: filter query by revisions only
 
        """
 
        cmts = ChangesetComment.query()\
 
            .filter(ChangesetComment.repo == self)
 
        if revisions:
 
        if revisions is not None:
 
            cmts = cmts.filter(ChangesetComment.revision.in_(revisions))
 
        grouped = collections.defaultdict(list)
 
        for cmt in cmts.all():
 
            grouped[cmt.revision].append(cmt)
 
        return grouped
 

	
 
@@ -2169,15 +2169,15 @@ class ChangesetComment(Base, BaseModel):
 

	
 
        :param cls:
 
        :param revision:
 
        """
 
        q = Session().query(User)\
 
                .join(ChangesetComment.author)
 
        if revision:
 
        if revision is not None:
 
            q = q.filter(cls.revision == revision)
 
        elif pull_request_id:
 
        elif pull_request_id is not None:
 
            q = q.filter(cls.pull_request_id == pull_request_id)
 
        return q.all()
 

	
 

	
 
class ChangesetStatus(Base, BaseModel):
 
    __tablename__ = 'changeset_statuses'
0 comments (0 inline, 0 general)