server/sources/storages.py
branchstable
changeset 8148 b7a195d54fd4
parent 8131 a6654712ad50
child 8180 1f6ba9afb925
child 8300 87c72dccf7b9
--- a/server/sources/storages.py	Tue Jan 03 12:21:44 2012 +0100
+++ b/server/sources/storages.py	Tue Jan 03 17:00:43 2012 +0100
@@ -113,6 +113,8 @@
 class BytesFileSystemStorage(Storage):
     """store Bytes attribute value on the file system"""
     def __init__(self, defaultdir, fsencoding='utf-8'):
+        if type(defaultdir) is unicode:
+            defaultdir = defaultdir.encode(fsencoding)
         self.default_directory = defaultdir
         self.fsencoding = fsencoding
 
@@ -201,7 +203,8 @@
         name = entity.cw_attr_metadata(attr, 'name')
         if name is not None:
             basename.append(name.encode(self.fsencoding))
-        fspath = uniquify_path(self.default_directory, '_'.join(basename))
+        fspath = uniquify_path(self.default_directory,
+                               '_'.join(basename))
         if fspath is None:
             msg = entity._cw._('failed to uniquify path (%s, %s)') % (
                 self.default_directory, '_'.join(basename))