Mercurial > kallithea
changeset 1641:cd1c21af123a
Fixed problems with unicode cache keys in celery
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 29 Oct 2011 17:44:46 +0200 |
parents | 747bc42f1f7d |
children | c0d8171ade36 |
files | rhodecode/lib/__init__.py rhodecode/lib/celerylib/__init__.py |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/__init__.py Thu Oct 27 00:26:24 2011 +0200 +++ b/rhodecode/lib/__init__.py Sat Oct 29 17:44:46 2011 +0200 @@ -195,6 +195,9 @@ :rtype: str :returns: str object """ + + if not isinstance(unicode_, basestring): + return str(unicode_) if isinstance(unicode_, str): return unicode_
--- a/rhodecode/lib/celerylib/__init__.py Thu Oct 27 00:26:24 2011 +0200 +++ b/rhodecode/lib/celerylib/__init__.py Sat Oct 29 17:44:46 2011 +0200 @@ -36,7 +36,7 @@ from vcs.utils.lazy import LazyProperty -from rhodecode.lib import str2bool +from rhodecode.lib import str2bool, safe_str from rhodecode.lib.pidlock import DaemonLock, LockHeld from celery.messaging import establish_connection @@ -87,7 +87,7 @@ func_name = str(func.__name__) if hasattr(func, '__name__') else str(func) lockkey = 'task_%s.lock' % \ - md5(func_name + '-' + '-'.join(map(str, params))).hexdigest() + md5(func_name + '-' + '-'.join(map(safe_str, params))).hexdigest() return lockkey