|
@@ -38,15 +38,10 @@ def get_export_format(storage_key: str, format: str):
|
|
|
def get_export(storage_key: str):
|
|
|
global setman, start, strg
|
|
|
format = setman.settings.export_format
|
|
|
- exp = None
|
|
|
- format = format.lower().strip()
|
|
|
- fac = exporter_factory()
|
|
|
- if format == "csv":
|
|
|
- exp = fac.make_csv()
|
|
|
- elif format == "json":
|
|
|
- exp = fac.make_json()
|
|
|
- elif format == "markdown":
|
|
|
- exp = fac.make_markdown()
|
|
|
+ try:
|
|
|
+ exp = exporter_factory().create(format)
|
|
|
+ except argument_exception as e:
|
|
|
+ return "Wrong format: " + e.error.error_text, 400
|
|
|
|
|
|
if storage_key not in strg.data:
|
|
|
return "Key not found", 404
|