Changeset - 742d1b8ca263
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-10-26 00:26:20
marcin@python-works.com
use str() on os.walk passing unicode can lead to UnicodeDecode errors when iterating
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/cleanup.py
Show inline comments
 
@@ -85,13 +85,13 @@ class CleanupCommand(BasePasterCommand):
 
        add_cache(config)
 
        engine = engine_from_config(config, 'sqlalchemy.db1.')
 
        init_model(engine)
 

	
 
        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)])
 

	
 
        #filter older than (if present)!
 
        now = datetime.datetime.now()
rhodecode/lib/hooks.py
Show inline comments
 
@@ -43,13 +43,13 @@ from rhodecode.model.db import Repositor
 
def _get_scm_size(alias, root_path):
 

	
 
    if not alias.startswith('.'):
 
        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:
 
                    size_scm += os.path.getsize(os.path.join(path, f))
 
                except OSError:
 
                    pass
0 comments (0 inline, 0 general)