pass
-class BookImportDocProvider(DocProvider):
- """Used for joined EPUB and PDF files."""
+class ORMDocProvider(DocProvider):
+ """Used for getting books' children."""
def __init__(self, book):
self.book = book
self.lock.close()
+@task
def create_zip(paths, zip_slug):
"""
Creates a zip in MEDIA_ROOT/zip directory containing files from path.
if not path.exists(path.join(zip_path, zip_filename)):
zipf = ZipFile(path.join(zip_path, zip_filename), 'w')
try:
- for p in paths:
- zipf.write(p, path.basename(p))
+ for arcname, p in paths:
+ if arcname is None:
+ arcname = path.basename(p)
+ zipf.write(p, arcname)
finally:
zipf.close()
except OSError as oe:
if oe.errno != ENOENT:
raise oe
-
-
-@task
-def create_zip_task(*args):
- return create_zip(*args)