Flatten the post data.
[audio.git] / src / archive / utils.py
index 476d506..35f7a74 100644 (file)
@@ -1,12 +1,12 @@
 from hashlib import sha1
 import os
 import os.path
 from hashlib import sha1
 import os
 import os.path
+import subprocess
 from django.core.files.storage import FileSystemStorage
 from django.core.files.uploadedfile import UploadedFile
 
 
 class ExistingFile(UploadedFile):
 from django.core.files.storage import FileSystemStorage
 from django.core.files.uploadedfile import UploadedFile
 
 
 class ExistingFile(UploadedFile):
-
     def __init__(self, path, *args, **kwargs):
         self.path = path
         return super(ExistingFile, self).__init__(*args, **kwargs)
     def __init__(self, path, *args, **kwargs):
         self.path = path
         return super(ExistingFile, self).__init__(*args, **kwargs)
@@ -19,7 +19,6 @@ class ExistingFile(UploadedFile):
 
 
 class OverwriteStorage(FileSystemStorage):
 
 
 class OverwriteStorage(FileSystemStorage):
-
     def _save(self, name, content):
         if self.exists(name):
             self.delete(name)
     def _save(self, name, content):
         if self.exists(name):
             self.delete(name)
@@ -31,14 +30,13 @@ class OverwriteStorage(FileSystemStorage):
 
 def sha1_file(f):
     sha = sha1()
 
 def sha1_file(f):
     sha = sha1()
-    for piece in iter(lambda: f.read(1024*1024), b''):
+    for piece in iter(lambda: f.read(1024 * 1024), b""):
         sha.update(piece)
     return sha.hexdigest()
 
 
 def all_files(root_path):
     root_len = len(root_path)
         sha.update(piece)
     return sha.hexdigest()
 
 
 def all_files(root_path):
     root_len = len(root_path)
-    for path, dirs, files in os.walk(root_path):
+    for path, dirs, files in os.walk(root_path, followlinks=True):
         for fname in files:
         for fname in files:
-            yield os.path.join(path, fname)[root_len:].lstrip('/')
-
+            yield os.path.join(path, fname)[root_len:].lstrip("/")