Mercurial > kallithea
changeset 6039:b7ec26b3df1b
cache-keys: fix printing of unicode repo names - don't crash
LANG=C paster cache-keys my.ini --show
would crash with UnicodeEncodeError in print. That was a real problem when
running from crontab.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 28 Jul 2016 16:28:34 +0200 |
parents | 9358211ee144 |
children | 21f1237772bb |
files | kallithea/lib/paster_commands/cache_keys.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/paster_commands/cache_keys.py Thu Jul 28 16:28:34 2016 +0200 +++ b/kallithea/lib/paster_commands/cache_keys.py Thu Jul 28 16:28:34 2016 +0200 @@ -32,6 +32,7 @@ from kallithea.model.meta import Session from kallithea.lib.utils import BasePasterCommand +from kallithea.lib.utils2 import safe_str from kallithea.model.db import CacheInvalidation # Add location of top level folder to sys.path @@ -58,11 +59,11 @@ _caches = CacheInvalidation.query().order_by(CacheInvalidation.cache_key).all() if self.options.show: for c_obj in _caches: - print 'key:%s active:%s' % (c_obj.cache_key, c_obj.cache_active) + print 'key:%s active:%s' % (safe_str(c_obj.cache_key), c_obj.cache_active) elif self.options.cleanup: for c_obj in _caches: Session().delete(c_obj) - print 'Removing key: %s' % (c_obj.cache_key) + print 'Removing key: %s' % (safe_str(c_obj.cache_key)) Session().commit() else: print 'Nothing done, exiting...'