Configuration¶
Flask extension for Invenio-Records-UI.
-
invenio_records_ui.config.
RECORDS_UI_DEFAULT_PERMISSION_FACTORY
= None¶ Configure the default permission factory.
-
invenio_records_ui.config.
RECORDS_UI_ENDPOINTS
= {'recid': {'pid_type': 'recid', 'route': '/records/<pid_value>', 'template': 'invenio_records_ui/detail.html'}, 'recid_export': {'pid_type': 'recid', 'view_imp': 'invenio_records_ui.views.export', 'route': '/records/<pid_value>/export/<format>', 'template': 'invenio_records_ui/export.html'}}¶ Default UI endpoints.
This option can be overwritten to describe the endpoints of the different record types.
Each element on the dictionary represent a independent endpoint.
The structure of the dictionary is as follows:
def my_view(pid, record, template=None): return render_template(template, pid=pid, record=record) def my_permission_factory(record, *args, **kwargs): def can(self): rec = Record.get_record(record.id) return rec.get('access', '') == 'open' return type('MyPermissionChecker', (), {'can': can})() RECORDS_UI_ENDPOINTS = { "<endpoint-name>": { "pid_type": "<record-pid-type>", "route": "/records/<pid_value>", "template": "invenio_records_ui/detail.html", "permission_factory_imp": "my_permission_factory", "view_imp": my_view, "record_class": "invenio_records.api:Record", "methods": ["GET", "POST", "PUT", "DELETE"], }, ... }
Parameters: - pid_type – Persistent identifier type for endpoint. Required.
- route – URL route (must include
<pid_value>
pattern). Required. - template – Template to render.
(Default:
invenio_records_ui/detail.html
) - permission_factory_imp – Import path to factory that creates a
permission object for a given record. If the value is
None
, then no access control is done. (Default:None
) - view_imp – Import path to view function. (Default:
None
) - record_class – Import path of record class.
(Default:
invenio_records.api:Record
) - methods – List of methods supported. (Default:
['GET']
)
-
invenio_records_ui.config.
RECORDS_UI_EXPORT_FORMATS
= {}¶ Defaut record serialization views.
The structure of the dictionary is as follows:
RECORDS_UI_EXPORT_FORMATS = { {"<pid-type>": { "<format-slug>": { "title": "<export format title>", "serializer": "<object or import path to record serializer>", "order": 1, }, ... }, ... }
-
invenio_records_ui.config.
RECORDS_UI_LOGIN_ENDPOINT
= 'security.login'¶ Endpoint where redirect the user if login is required.
-
invenio_records_ui.config.
RECORDS_UI_TOMBSTONE_TEMPLATE
= 'invenio_records_ui/tombstone.html'¶ Configure the tombstone template.