# HG changeset patch
# User Alexandre Fayolle <alexandre.fayolle@logilab.fr>
# Date 1325606443 -3600
# Node ID b7a195d54fd4295c64ee442e183dd30a24170e21
# Parent  335b358c701769db7df04493ef47ab296275d60a
[bfss] convert root BFSS directory to str in constructor (closes #2137793)

otherwise you can get crashed with AssertionError: Binary objects must use raw strings, not <type 'unicode'>

diff -r 335b358c7017 -r b7a195d54fd4 server/sources/storages.py
--- 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))