1515# Filesystem
1616from fs import path
1717from fs import copy
18- from django .utils .encoding import smart_str as smart_text
18+ from django .utils .encoding import smart_str
1919
2020# Pooling
2121import multiprocessing
@@ -128,9 +128,9 @@ def set_options(self, *args, **options):
128128 self .build_dir = settings .BUILD_DIR
129129
130130 # Get the datatypes right so fs will be happy
131- self .build_dir = smart_text (self .build_dir )
132- self .static_root = smart_text (settings .STATIC_ROOT )
133- self .media_root = smart_text (settings .MEDIA_ROOT )
131+ self .build_dir = smart_str (self .build_dir )
132+ self .static_root = smart_str (settings .STATIC_ROOT )
133+ self .media_root = smart_str (settings .MEDIA_ROOT )
134134
135135 # Connect the BUILD_DIR with our filesystem backend
136136 self .app = apps .get_app_config ("bakery" )
@@ -176,7 +176,7 @@ def build_static(self, *args, **options):
176176
177177 # Set the target directory inside the filesystem.
178178 target_dir = path .join (self .build_dir , settings .STATIC_URL .lstrip ("/" ))
179- target_dir = smart_text (target_dir )
179+ target_dir = smart_str (target_dir )
180180 if os .path .exists (self .static_root ) and settings .STATIC_URL :
181181 if getattr (settings , "BAKERY_GZIP" , False ):
182182 self .copytree_and_gzip (self .static_root , target_dir )
@@ -210,7 +210,7 @@ def build_media(self):
210210 if os .path .exists (self .media_root ) and settings .MEDIA_URL :
211211 target_dir = path .join (self .build_dir , settings .MEDIA_URL .lstrip ("/" ))
212212 logger .debug ("Copying {}{} to {}{}" .format ("osfs://" , self .media_root , self .fs_name , target_dir ))
213- copy .copy_dir ("osfs:///" , smart_text (self .media_root ), self .fs , smart_text (target_dir ))
213+ copy .copy_dir ("osfs:///" , smart_str (self .media_root ), self .fs , smart_str (target_dir ))
214214
215215 def get_view_instance (self , view ):
216216 """
@@ -294,7 +294,7 @@ def copyfile_and_gzip(self, source_path, target_path):
294294 "osfs://" , source_path , self .fs_name , target_path
295295 )
296296 )
297- copy .copy_file ("osfs:///" , smart_text (source_path ), self .fs , smart_text (target_path ))
297+ copy .copy_file ("osfs:///" , smart_str (source_path ), self .fs , smart_str (target_path ))
298298
299299 # # if the file is already gzipped
300300 elif encoding == "gzip" :
@@ -303,7 +303,7 @@ def copyfile_and_gzip(self, source_path, target_path):
303303 "osfs://" , source_path , self .fs_name , target_path
304304 )
305305 )
306- copy .copy_file ("osfs:///" , smart_text (source_path ), self .fs , smart_text (target_path ))
306+ copy .copy_file ("osfs:///" , smart_str (source_path ), self .fs , smart_str (target_path ))
307307
308308 # If it is one we want to gzip...
309309 else :
@@ -320,6 +320,6 @@ def copyfile_and_gzip(self, source_path, target_path):
320320 f .write (six .binary_type (source_file .read ()))
321321
322322 # Write that buffer out to the filesystem
323- with self .fs .open (smart_text (target_path ), "wb" ) as outfile :
323+ with self .fs .open (smart_str (target_path ), "wb" ) as outfile :
324324 outfile .write (data_buffer .getvalue ())
325325 outfile .close ()
0 commit comments