Merge pull request #772 from taigaio/remove-storage-path-call

Remove storage.path usage for allow other Storage Backends
remotes/origin/issue/4795/notification_even_they_are_disabled
David Barragán Merino 2016-07-08 13:00:51 +02:00 committed by GitHub
commit b0df33ed2e
2 changed files with 4 additions and 8 deletions

View File

@ -76,13 +76,11 @@ class ProjectExporterViewSet(mixins.ImportThrottlingPolicyMixin, GenericViewSet)
if dump_format == "gzip":
path = "exports/{}/{}-{}.json.gz".format(project.pk, project.slug, uuid.uuid4().hex)
storage_path = default_storage.path(path)
with default_storage.open(storage_path, mode="wb") as outfile:
with default_storage.open(path, mode="wb") as outfile:
services.render_project(project, gzip.GzipFile(fileobj=outfile))
else:
path = "exports/{}/{}-{}.json".format(project.pk, project.slug, uuid.uuid4().hex)
storage_path = default_storage.path(path)
with default_storage.open(storage_path, mode="wb") as outfile:
with default_storage.open(path, mode="wb") as outfile:
services.render_project(project, outfile)
response_data = {

View File

@ -46,13 +46,11 @@ def dump_project(self, user, project, dump_format):
try:
if dump_format == "gzip":
path = "exports/{}/{}-{}.json.gz".format(project.pk, project.slug, self.request.id)
storage_path = default_storage.path(path)
with default_storage.open(storage_path, mode="wb") as outfile:
with default_storage.open(path, mode="wb") as outfile:
services.render_project(project, gzip.GzipFile(fileobj=outfile))
else:
path = "exports/{}/{}-{}.json".format(project.pk, project.slug, self.request.id)
storage_path = default_storage.path(path)
with default_storage.open(storage_path, mode="wb") as outfile:
with default_storage.open(path, mode="wb") as outfile:
services.render_project(project, outfile)
url = default_storage.url(path)