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
 
@@ -31,6 +31,7 @@ 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
 
@@ -56,15 +57,14 @@ class Command(BasePasterCommand):
 
        #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()
 

	
0 comments (0 inline, 0 general)