now you can post art. No associated user yet though.
[zzz-floof.git] / floof / lib / file_storage.py
index 5595e88..1d1c720 100644 (file)
@@ -3,6 +3,8 @@ import os, shutil, tempfile, hashlib
 
 chunk_size = 1024*1024 # TODO: is this a good chunk size?
 
+from pylons import config
+
 """
 Notes:
 # Here's one way to move stuff...
@@ -16,8 +18,14 @@ from mimetypes import guess_type
 guess_type(temp.filename)[0]
 """
 
+def get_path(space, hash):
+    return os.path.join( space, hash[:2], hash[2:] )
+    
 
-def save_file(dest_root, temp):    
+def save_file(space, temp):   
+     
+    dest_root = os.path.join( config['app_conf']['static_root'], space )
+    
     # we don't know where we're going to save this stuff yet,
     # so I guess we'll write it to another tempfile.  One we know the path of.
     # I'm assuming the tempfile we get from pylons is set to delete itself