# HG changeset patch # User Mads Kiilerich # Date 1469716114 -7200 # Node ID b7ec26b3df1b1b2a2ffe92354968c0eab38d1781 # Parent 9358211ee1441de84d807115d5f5a12e9aa48bd1 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. diff -r 9358211ee144 -r b7ec26b3df1b kallithea/lib/paster_commands/cache_keys.py --- 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...'