diff rhodecode/lib/helpers.py @ 1176:014c9a58a0d9 beta

fixes for issues #137 and #116 safe_unicode is now default for handling file names
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 24 Mar 2011 16:35:53 +0100
parents 2ab211e0aecd
children 08d77411c881
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Wed Mar 23 20:58:12 2011 +0100
+++ b/rhodecode/lib/helpers.py	Thu Mar 24 16:35:53 2011 +0100
@@ -36,7 +36,7 @@
 
 from vcs.utils.annotate import annotate_highlight
 from rhodecode.lib.utils import repo_name_slug
-from rhodecode.lib import str2bool
+from rhodecode.lib import str2bool, safe_unicode
 
 def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
     """
@@ -192,7 +192,7 @@
 
     def __call__(self, repo_name, rev, paths):
         if isinstance(paths, str):
-            paths = paths.decode('utf-8', 'replace')
+            paths = safe_unicode(paths)
         url_l = [link_to(repo_name, url('files_home',
                                         repo_name=repo_name,
                                         revision=rev, f_path=''))]
@@ -680,7 +680,7 @@
         suf = ''
         if len(nodes) > 30:
             suf = '<br/>' + _(' and %s more') % (len(nodes) - 30)
-        return literal(pref + '<br/> '.join([x.path.decode('utf-8', 'replace') for x in nodes[:30]]) + suf)
+        return literal(pref + '<br/> '.join([safe_unicode(x.path) for x in nodes[:30]]) + suf)
     else:
         return ': ' + _('No Files')