Skip to content

Commit 28f6d1a

Browse files
continue fixing
1 parent 2e6fc93 commit 28f6d1a

File tree

3 files changed

+8
-7
lines changed
  • packages/models-library/src/models_library/api_schemas_webserver
  • services/web/server/src/simcore_service_webserver

3 files changed

+8
-7
lines changed

packages/models-library/src/models_library/api_schemas_webserver/groups.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from contextlib import suppress
22

33
from pydantic import (
4+
AnyHttpUrl,
45
AnyUrl,
56
BaseModel,
67
ConfigDict,
@@ -90,7 +91,7 @@ def _sanitize_legacy_data(cls, v):
9091
if v:
9192
# Enforces null if thumbnail is not valid URL or empty
9293
with suppress(ValidationError):
93-
return TypeAdapter(AnyUrl).validate_python(v)
94+
return TypeAdapter(AnyHttpUrl).validate_python(v)
9495
return None
9596

9697

services/web/server/src/simcore_service_webserver/login/settings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Final, Literal
33

44
from aiohttp import web
5-
from pydantic import BaseModel, field_validator
5+
from pydantic import BaseModel, ValidationInfo, field_validator
66
from pydantic.fields import Field
77
from pydantic.types import PositiveFloat, PositiveInt, SecretStr
88
from settings_library.base import BaseCustomSettings
@@ -56,17 +56,17 @@ class LoginSettings(BaseCustomSettings):
5656

5757
@field_validator("LOGIN_2FA_REQUIRED")
5858
@classmethod
59-
def login_2fa_needs_email_registration(cls, v, values):
59+
def _login_2fa_needs_email_registration(cls, v, info: ValidationInfo):
6060
# NOTE: this constraint ensures that a phone is registered in current workflow
61-
if v and not values.get("LOGIN_REGISTRATION_CONFIRMATION_REQUIRED", False):
61+
if v and not info.data.get("LOGIN_REGISTRATION_CONFIRMATION_REQUIRED", False):
6262
msg = "Cannot enable 2FA w/o email confirmation"
6363
raise ValueError(msg)
6464
return v
6565

6666
@field_validator("LOGIN_2FA_REQUIRED")
6767
@classmethod
68-
def login_2fa_needs_sms_service(cls, v, values):
69-
if v and values.get("LOGIN_TWILIO") is None:
68+
def _login_2fa_needs_sms_service(cls, v, info: ValidationInfo):
69+
if v and info.data.get("LOGIN_TWILIO") is None:
7070
msg = "Cannot enable 2FA w/o twilio settings which is used to send SMS"
7171
raise ValueError(msg)
7272
return v

services/web/server/src/simcore_service_webserver/products/_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def get_template_name_for(self, filename: str) -> str | None:
267267
"""Checks for field marked with 'x_template_name' that fits the argument"""
268268
template_name = filename.removesuffix(".jinja2")
269269
for name, field in self.model_fields.items():
270-
if field.json_schema_extra.get("x_template_name") == template_name:
270+
if field.json_schema_extra and field.json_schema_extra.get("x_template_name") == template_name:
271271
template_name_attribute: str = getattr(self, name)
272272
return template_name_attribute
273273
return None

0 commit comments

Comments
 (0)