Changeset - 039a3f88518a
[Not reviewed]
default
0 1 0
Mads Kiilerich - 9 years ago 2016-07-28 16:28:34
madski@unity3d.com
update-repoinfo: pass command line repository names to the database as unicode

Fix bind SAWarning about not receiving unicode.
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/paster_commands/update_repoinfo.py
Show inline comments
 
@@ -28,12 +28,13 @@ Original author and date, and relevant c
 

	
 
import os
 
import sys
 
import string
 

	
 
from kallithea.lib.utils import BasePasterCommand
 
from kallithea.lib.utils2 import safe_unicode
 
from kallithea.model.db import Repository
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.meta import Session
 

	
 
# Add location of top level folder to sys.path
 
from os.path import dirname
 
@@ -53,21 +54,20 @@ class Command(BasePasterCommand):
 
    summary = "Updates repositories caches for last changeset"
 

	
 
    def command(self):
 
        #get SqlAlchemy session
 
        self._init_session()
 

	
 
        repo_update_list = map(string.strip,
 
                               self.options.repo_update_list.split(',')) \
 
                               if self.options.repo_update_list else None
 

	
 
        if repo_update_list is not None:
 
            repo_list = list(Repository.query() \
 
                .filter(Repository.repo_name.in_(repo_update_list)))
 
        if self.options.repo_update_list is None:
 
            repo_list = Repository.getAll()
 
        else:
 
            repo_list = Repository.getAll()
 
            repo_names = [safe_unicode(n.strip())
 
                          for n in self.options.repo_update_list.split(',')]
 
            repo_list = list(Repository.query()
 
                .filter(Repository.repo_name.in_(repo_names)))
 
        RepoModel.update_repoinfo(repositories=repo_list)
 
        Session().commit()
 

	
 
        if self.options.invalidate_cache:
 
            for r in repo_list:
 
                r.set_invalidate()
0 comments (0 inline, 0 general)