Skip to content

Commit

Permalink
First commit #2616 #2594 #2591
Browse files Browse the repository at this point in the history
  • Loading branch information
pesikj committed Dec 6, 2024
1 parent 181e5e2 commit 4a4e2b0
Show file tree
Hide file tree
Showing 23 changed files with 874 additions and 364 deletions.
2 changes: 0 additions & 2 deletions docker-compose-dev-local-db-all-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ services:

celery_exporter:
image: danihodovic/celery-exporter:0.10.8
networks:
- prod-net
secrets:
- redis_pass
- redis_host
Expand Down
10 changes: 9 additions & 1 deletion webclient/core/repository_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from xml_generator.generator import DocumentGenerator
from xml_generator.models import ModelWithMetadata

from redis import ResponseError

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -1336,7 +1338,13 @@ def _send_transaction_request(self, operation=FedoraTransactionOperation.COMMIT)
auth = HTTPBasicAuth(settings.FEDORA_ADMIN_USER, settings.FEDORA_ADMIN_USER_PASSWORD)
if operation == FedoraTransactionOperation.COMMIT:
response = requests.put(url, auth=auth, verify=False)
self._save_transaction_result_to_redis(FedoraTransactionResult.COMMITED)
try:
self._save_transaction_result_to_redis(FedoraTransactionResult.COMMITED)
except ResponseError as err:
logger.error(
"core_repository_connector.FedoraTransaction._save_transaction_result_to_redis.failed",
extra={"transaction": self.uid, "err": err},
)
elif operation == FedoraTransactionOperation.ROLLBACK:
response = requests.delete(url, auth=auth, verify=False)
self._save_transaction_result_to_redis(FedoraTransactionResult.ABORTED)
Expand Down
9 changes: 9 additions & 0 deletions webclient/core/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
logger = logging.getLogger(__name__)


orcid_pattern = re.compile(r"\d{4}-\d{4}-\d{4}-\d{4}")


def validate_phone_number(number):
"""
Validátor pro ověření telefonního čísla na správny formát.
Expand Down Expand Up @@ -37,3 +40,9 @@ def validate_date_min_1600(value):
raise ValidationError(_("core.validators.validate_date_min_1600.not_valid_upper"))
elif value and value <= min_date:
raise ValidationError(_("core.validators.validate_date_min_1600.not_valid"))


def validate_orcid(orcid):
match = orcid_pattern.search(orcid)
if not match:
raise ValidationError(_("core.validators.validate_orcid.not_valid"))
2 changes: 1 addition & 1 deletion webclient/doi/admin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.contrib import admin
from django.template.response import TemplateResponse
from django.urls import path
from doi.doi_serializers import DokumentSerializer
from doi.forms import UpdateDocumentObjectIdentifierFileForm
from doi.model_serializers import DokumentSerializer
from dokument.models import Dokument


Expand Down
Loading

0 comments on commit 4a4e2b0

Please sign in to comment.