Remove storage.path usage for allow other Storage Backends
parent
6abac42047
commit
c110d6d1a2
|
@ -76,13 +76,11 @@ class ProjectExporterViewSet(mixins.ImportThrottlingPolicyMixin, GenericViewSet)
|
||||||
|
|
||||||
if dump_format == "gzip":
|
if dump_format == "gzip":
|
||||||
path = "exports/{}/{}-{}.json.gz".format(project.pk, project.slug, uuid.uuid4().hex)
|
path = "exports/{}/{}-{}.json.gz".format(project.pk, project.slug, uuid.uuid4().hex)
|
||||||
storage_path = default_storage.path(path)
|
with default_storage.open(path, mode="wb") as outfile:
|
||||||
with default_storage.open(storage_path, mode="wb") as outfile:
|
|
||||||
services.render_project(project, gzip.GzipFile(fileobj=outfile))
|
services.render_project(project, gzip.GzipFile(fileobj=outfile))
|
||||||
else:
|
else:
|
||||||
path = "exports/{}/{}-{}.json".format(project.pk, project.slug, uuid.uuid4().hex)
|
path = "exports/{}/{}-{}.json".format(project.pk, project.slug, uuid.uuid4().hex)
|
||||||
storage_path = default_storage.path(path)
|
with default_storage.open(path, mode="wb") as outfile:
|
||||||
with default_storage.open(storage_path, mode="wb") as outfile:
|
|
||||||
services.render_project(project, outfile)
|
services.render_project(project, outfile)
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
|
|
|
@ -46,13 +46,11 @@ def dump_project(self, user, project, dump_format):
|
||||||
try:
|
try:
|
||||||
if dump_format == "gzip":
|
if dump_format == "gzip":
|
||||||
path = "exports/{}/{}-{}.json.gz".format(project.pk, project.slug, self.request.id)
|
path = "exports/{}/{}-{}.json.gz".format(project.pk, project.slug, self.request.id)
|
||||||
storage_path = default_storage.path(path)
|
with default_storage.open(path, mode="wb") as outfile:
|
||||||
with default_storage.open(storage_path, mode="wb") as outfile:
|
|
||||||
services.render_project(project, gzip.GzipFile(fileobj=outfile))
|
services.render_project(project, gzip.GzipFile(fileobj=outfile))
|
||||||
else:
|
else:
|
||||||
path = "exports/{}/{}-{}.json".format(project.pk, project.slug, self.request.id)
|
path = "exports/{}/{}-{}.json".format(project.pk, project.slug, self.request.id)
|
||||||
storage_path = default_storage.path(path)
|
with default_storage.open(path, mode="wb") as outfile:
|
||||||
with default_storage.open(storage_path, mode="wb") as outfile:
|
|
||||||
services.render_project(project, outfile)
|
services.render_project(project, outfile)
|
||||||
|
|
||||||
url = default_storage.url(path)
|
url = default_storage.url(path)
|
||||||
|
|
Loading…
Reference in New Issue