diff --git a/ereuse_devicehub/resources/documents/documents.py b/ereuse_devicehub/resources/documents/documents.py index 8e8db6ff..f45cf808 100644 --- a/ereuse_devicehub/resources/documents/documents.py +++ b/ereuse_devicehub/resources/documents/documents.py @@ -115,34 +115,6 @@ class DocumentView(DeviceView): } 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): @cache(datetime.timedelta(minutes=1)) @@ -445,12 +417,6 @@ class DocumentDef(Resource): self.add_url_rule('/internalstats/', defaults=d, view_func=internalstats_view, 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', definition=self, auth=app.auth) diff --git a/tests/test_basic.py b/tests/test_basic.py index 18973f6a..c04e8fb6 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -40,7 +40,6 @@ def test_api_docs(client: Client): '/documents/erasures/', '/documents/devices/', '/documents/stamps/', - '/documents/externalErasureDocuments/', '/documents/wbconf/{wbtype}', '/documents/internalstats/', '/documents/stock/',