Changeset View
Changeset View
Standalone View
Standalone View
swh/web/common/utils.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import docutils.parsers.rst | import docutils.parsers.rst | ||||
import docutils.utils | import docutils.utils | ||||
import re | import re | ||||
from datetime import datetime, timezone | from datetime import datetime, timezone | ||||
from dateutil import parser as date_parser | from dateutil import parser as date_parser | ||||
from dateutil import tz | from dateutil import tz | ||||
from django.urls import reverse as django_reverse | from django.urls import reverse as django_reverse | ||||
from django.http import QueryDict | from django.http import QueryDict | ||||
from prometheus_client.registry import CollectorRegistry | |||||
from rest_framework.authentication import SessionAuthentication | from rest_framework.authentication import SessionAuthentication | ||||
from swh.model.exceptions import ValidationError | from swh.model.exceptions import ValidationError | ||||
from swh.model.identifiers import ( | from swh.model.identifiers import ( | ||||
persistent_identifier, parse_persistent_identifier, | persistent_identifier, parse_persistent_identifier, | ||||
CONTENT, DIRECTORY, RELEASE, REVISION, SNAPSHOT | CONTENT, DIRECTORY, RELEASE, REVISION, SNAPSHOT | ||||
) | ) | ||||
from swh.web.common.exc import BadInputExc | from swh.web.common.exc import BadInputExc | ||||
SWH_WEB_METRICS_REGISTRY = CollectorRegistry(auto_describe=True) | |||||
swh_object_icons = { | swh_object_icons = { | ||||
'branch': 'fa fa-code-fork', | 'branch': 'fa fa-code-fork', | ||||
'branches': 'fa fa-code-fork', | 'branches': 'fa fa-code-fork', | ||||
'content': 'fa fa-file-text', | 'content': 'fa fa-file-text', | ||||
'directory': 'fa fa-folder', | 'directory': 'fa fa-folder', | ||||
'person': 'fa fa-user', | 'person': 'fa fa-user', | ||||
'revisions history': 'fa fa-history', | 'revisions history': 'fa fa-history', | ||||
'release': 'fa fa-tag', | 'release': 'fa fa-tag', | ||||
▲ Show 20 Lines • Show All 304 Lines • Show Last 20 Lines |