EMAIL_HOST = 'localhost'
DEFAULT_FROM_EMAIL = 'webmaster@parisson.com'
+
+FILE_UPLOAD_TEMP_DIR = '/tmp'
\ No newline at end of file
if len(buffer) == 0:
break
hash.update(buffer)
- file.close()
+ file.close()
return hash.hexdigest()
def __get_media_filename(self, item):
return str(item.id) + ".wav"
def store(self, dest_dir):
- """Serialize and store the collection with related items and media
+ """Serialize and store the collection with related items and media
files into a subdirectory of the provided directory
"""
coll_dir = dest_dir + "/" + str(self.collection.id)
md5_file.close()
def get_xml(self):
- """Return a string containing the XML representation of the collection
+ """Return a string containing the XML representation of the collection
and related items
"""
impl = getDOMImplementation()
tree.free()
return xml
-
+
import json
collection = self.get_object()
- temp = tempfile.TemporaryFile(prefix=settings.FILE_UPLOAD_TEMP_DIR+os.sep)
+ tmp_dir = getattr(settings, "FILE_UPLOAD_TEMP_DIR")
+ if not tmp_dir:
+ tmp_dir = '/tmp'
+ temp = tempfile.TemporaryFile(prefix=tmp_dir+os.sep)
archive = zipfile.ZipFile(temp, 'w', zipfile.ZIP_DEFLATED, allowZip64=True)
serializer = CollectionSerializer(collection)
archive.writestr('%s/%s%s' % (collection.code, collection.code, '.xml'),