2023-01-18 17:56:04 +00:00
|
|
|
from typing import Callable, Iterable, Tuple
|
|
|
|
|
2023-06-05 14:00:10 +00:00
|
|
|
from flask import redirect, url_for
|
2023-01-18 17:56:04 +00:00
|
|
|
|
2023-05-24 08:25:04 +00:00
|
|
|
from ereuse_devicehub.teal.resource import Resource, View
|
2023-01-18 17:56:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DidView(View):
|
|
|
|
"""
|
|
|
|
This view render one public ans static page for see the links for to do the check
|
|
|
|
of one csv file
|
|
|
|
"""
|
2023-01-19 11:26:25 +00:00
|
|
|
|
2023-01-18 17:56:04 +00:00
|
|
|
def get(self, dpp: str):
|
2023-06-05 14:00:10 +00:00
|
|
|
return redirect(url_for('did.did', id_dpp=dpp))
|
2023-01-18 17:56:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DidDef(Resource):
|
|
|
|
__type__ = 'Did'
|
|
|
|
SCHEMA = None
|
|
|
|
VIEW = None # We do not want to create default / documents endpoint
|
|
|
|
AUTH = False
|
|
|
|
|
2023-01-19 11:26:25 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
app,
|
|
|
|
import_name=__name__,
|
|
|
|
static_folder='static',
|
|
|
|
static_url_path=None,
|
|
|
|
template_folder='templates',
|
|
|
|
url_prefix=None,
|
|
|
|
subdomain=None,
|
|
|
|
url_defaults=None,
|
|
|
|
root_path=None,
|
|
|
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
|
|
|
):
|
|
|
|
super().__init__(
|
|
|
|
app,
|
|
|
|
import_name,
|
|
|
|
static_folder,
|
|
|
|
static_url_path,
|
|
|
|
template_folder,
|
|
|
|
url_prefix,
|
|
|
|
subdomain,
|
|
|
|
url_defaults,
|
|
|
|
root_path,
|
|
|
|
cli_commands,
|
|
|
|
)
|
2023-01-18 17:56:04 +00:00
|
|
|
|
2023-05-24 08:25:04 +00:00
|
|
|
# view = DidView.as_view('main', definition=self, auth=app.auth)
|
2023-01-18 17:56:04 +00:00
|
|
|
|
|
|
|
# if self.AUTH:
|
|
|
|
# view = app.auth.requires_auth(view)
|
|
|
|
|
|
|
|
did_view = DidView.as_view('DidView', definition=self, auth=app.auth)
|
2023-01-19 11:26:25 +00:00
|
|
|
self.add_url_rule(
|
|
|
|
'/<string:dpp>', defaults={}, view_func=did_view, methods={'GET'}
|
|
|
|
)
|