Remove storage.path usage for allow other Storage Backends

remotes/origin/issue/4795/notification_even_they_are_disabled
Jesús Espino 2016-06-29 20:55:06 +02:00 committed by David Barragán Merino
parent 6abac42047
commit c110d6d1a2
2 changed files with 4 additions and 8 deletions

View File

@ -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 = {

View File

@ -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)