diff rhodecode/lib/celerylib/tasks.py @ 1401:b7563ad4e7ee beta

Unicode fixes, added safe_str method for global str() operations +better test sandboxing
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 30 Jun 2011 01:25:37 +0200
parents 9c0f5d558789
children 5875955def39
line wrap: on
line diff
--- a/rhodecode/lib/celerylib/tasks.py	Wed Jun 29 01:49:53 2011 +0200
+++ b/rhodecode/lib/celerylib/tasks.py	Thu Jun 30 01:25:37 2011 +0200
@@ -37,7 +37,7 @@
 from pylons import config
 from pylons.i18n.translation import _
 
-from rhodecode.lib import LANGUAGES_EXTENSIONS_MAP
+from rhodecode.lib import LANGUAGES_EXTENSIONS_MAP, safe_str
 from rhodecode.lib.celerylib import run_task, locked_task, str2bool, \
     __get_lockkey, LockHeld, DaemonLock
 from rhodecode.lib.helpers import person
@@ -66,7 +66,6 @@
 CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
 
 
-
 def get_session():
     if CELERY_ON:
         engine = engine_from_config(config, 'sqlalchemy.db1.')
@@ -112,8 +111,7 @@
         co_day_auth_aggr = {}
         commits_by_day_aggregate = {}
         repos_path = get_repos_path()
-        p = os.path.join(repos_path, repo_name)
-        repo = get_repo(p)
+        repo = get_repo(safe_str(os.path.join(repos_path, repo_name)))
         repo_size = len(repo.revisions)
         #return if repo have no revisions
         if repo_size < 1:
@@ -358,8 +356,7 @@
 
 def __get_codes_stats(repo_name):
     repos_path = get_repos_path()
-    p = os.path.join(repos_path, repo_name)
-    repo = get_repo(p)
+    repo = get_repo(safe_str(os.path.join(repos_path, repo_name)))
     tip = repo.get_changeset()
     code_stats = {}