prewikka/master: Handle unicode in charts name/username

[email protected] Wed, 10 Feb 2010 13:38:46 +0100 (CET)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 111b307aace3b62bd2a2213e6d7fbe86090634b9
Author: Yoann Vandoorselaere <[email protected]>
Date:   Wed Feb 10 13:33:17 2010 +0100

    Handle unicode in charts name/username
    
    There could be an exception when generating a charts if the chart name
    or username contained Unicode characters


========================================

 prewikka/Chart.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

========================================

diff --git a/prewikka/Chart.py b/prewikka/Chart.py
index 189dcdc..a93d1d1 100644
--- a/prewikka/Chart.py
+++ b/prewikka/Chart.py
@@ -144,10 +144,10 @@ class ChartCommon:
 
     def _getFilename(self, name, expire = None, uid=None, gid=None, suffix=".png"):
         old_mask = os.umask(0)
-        basename = base64.urlsafe_b64encode(name)
+        basename = base64.urlsafe_b64encode(name.encode("utf-8"))
         pathname = os.path.join(siteconfig.htdocs_dir, "generated_images")
 
-        user = base64.urlsafe_b64encode(self._user.login)
+        user = base64.urlsafe_b64encode(self._user.login.encode("utf-8"))
         pathname = os.path.normpath(os.path.join(pathname, user))
 
         try:
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-technologies.com/mailman/listinfo/prelude-cvslog