# HG changeset patch # User Mads Kiilerich # Date 1469716114 -7200 # Node ID 039a3f88518a9d9875d87381a87a165ca3a5453f # Parent 186bf5fee0a184351545ddc9b1747da423b53811 update-repoinfo: pass command line repository names to the database as unicode Fix bind SAWarning about not receiving unicode. diff -r 186bf5fee0a1 -r 039a3f88518a kallithea/lib/paster_commands/update_repoinfo.py --- a/kallithea/lib/paster_commands/update_repoinfo.py Thu Jul 28 16:28:34 2016 +0200 +++ b/kallithea/lib/paster_commands/update_repoinfo.py Thu Jul 28 16:28:34 2016 +0200 @@ -31,6 +31,7 @@ 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 @@ #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()