drop endpoint

This commit is contained in:
Cayo Puigdefabregas 2021-07-29 11:19:45 +02:00
parent bb3145f3d8
commit f8ce81cc19
2 changed files with 0 additions and 35 deletions

View File

@ -115,34 +115,6 @@ class DocumentView(DeviceView):
} }
return flask.render_template('documents/erasure.html', **params) return flask.render_template('documents/erasure.html', **params)
class ExternalErasureDocumentView(DeviceView):
@cache(datetime.timedelta(minutes=1))
def find(self, args: dict):
query = (x for x in self.query(args) if x.owner_id == g.user.id)
return self.generate_post_csv(query)
def generate_post_csv(self, query):
"""Get device query and put information in csv format."""
data = StringIO()
cw = csv.writer(data, delimiter=';', lineterminator="\n", quotechar='"')
cw.writerow(['Urls'])
for device in query:
if isinstance(device, devs.Computer):
urls = device.external_document_erasure
if urls:
cw.writerow(urls)
elif isinstance(device, devs.DataStorage):
url = device.external_document_erasure
if url:
cw.writerow(set(url))
bfile = data.getvalue().encode('utf-8')
output = make_response(bfile)
insert_hash(bfile)
output.headers['Content-Disposition'] = 'attachment; filename=export_urls_external_proof.csv'
output.headers['Content-type'] = 'text/csv'
return output
class DevicesDocumentView(DeviceView): class DevicesDocumentView(DeviceView):
@cache(datetime.timedelta(minutes=1)) @cache(datetime.timedelta(minutes=1))
@ -445,12 +417,6 @@ class DocumentDef(Resource):
self.add_url_rule('/internalstats/', defaults=d, view_func=internalstats_view, self.add_url_rule('/internalstats/', defaults=d, view_func=internalstats_view,
methods=get) methods=get)
externalErasureDocument_view = ExternalErasureDocumentView.as_view(
'ExternalErasureDocumentView', definition=self, auth=app.auth)
externalErasureDocument_view = app.auth.requires_auth(externalErasureDocument_view)
self.add_url_rule('/externalErasureDocuments/', defaults=d,
view_func=externalErasureDocument_view, methods=get)
actions_view = ActionsDocumentView.as_view('ActionsDocumentView', actions_view = ActionsDocumentView.as_view('ActionsDocumentView',
definition=self, definition=self,
auth=app.auth) auth=app.auth)

View File

@ -40,7 +40,6 @@ def test_api_docs(client: Client):
'/documents/erasures/', '/documents/erasures/',
'/documents/devices/', '/documents/devices/',
'/documents/stamps/', '/documents/stamps/',
'/documents/externalErasureDocuments/',
'/documents/wbconf/{wbtype}', '/documents/wbconf/{wbtype}',
'/documents/internalstats/', '/documents/internalstats/',
'/documents/stock/', '/documents/stock/',