# HG changeset patch # User Marcin Kuzminski # Date 2012-10-26 00:26:20 # Node ID 742d1b8ca263d1329c06d39bb41e22cb60566f9d # Parent c400f2fbf1310bc5b991dbde27ce59236b674700 use str() on os.walk passing unicode can lead to UnicodeDecode errors when iterating diff --git a/rhodecode/lib/cleanup.py b/rhodecode/lib/cleanup.py --- a/rhodecode/lib/cleanup.py +++ b/rhodecode/lib/cleanup.py @@ -88,7 +88,7 @@ class CleanupCommand(BasePasterCommand): repos_location = RhodeCodeUi.get_repos_location() to_remove = [] - for dn, dirs, f in os.walk(str(repos_location)): + for dn, dirs, f in os.walk(safe_str(repos_location)): for loc in dirs: if REMOVED_REPO_PAT.match(loc): to_remove.append([loc, self._extract_date(loc)]) diff --git a/rhodecode/lib/hooks.py b/rhodecode/lib/hooks.py --- a/rhodecode/lib/hooks.py +++ b/rhodecode/lib/hooks.py @@ -46,7 +46,7 @@ def _get_scm_size(alias, root_path): alias += '.' size_scm, size_root = 0, 0 - for path, dirs, files in os.walk(root_path): + for path, dirs, files in os.walk(safe_str(root_path)): if path.find(alias) != -1: for f in files: try: