changeset 2963:742d1b8ca263 beta

use str() on os.walk passing unicode can lead to UnicodeDecode errors when iterating
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 26 Oct 2012 00:26:20 +0200
parents c400f2fbf131
children cc21f0495d3a
files rhodecode/lib/cleanup.py rhodecode/lib/hooks.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/cleanup.py	Fri Oct 26 00:25:21 2012 +0200
+++ b/rhodecode/lib/cleanup.py	Fri Oct 26 00:26:20 2012 +0200
@@ -88,7 +88,7 @@
 
         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)])
--- a/rhodecode/lib/hooks.py	Fri Oct 26 00:25:21 2012 +0200
+++ b/rhodecode/lib/hooks.py	Fri Oct 26 00:26:20 2012 +0200
@@ -46,7 +46,7 @@
         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: