Skip to content

Commit 5058bf7

Browse files
committed
mark more messages
1 parent f1ae069 commit 5058bf7

File tree

8 files changed

+35
-20
lines changed

8 files changed

+35
-20
lines changed

services/web/server/src/simcore_service_webserver/catalog/_constants.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from typing import Final
22

3+
from common_library.user_messages import user_message
4+
35
from ..constants import MSG_TRY_AGAIN_OR_SUPPORT
46

5-
MSG_CATALOG_SERVICE_UNAVAILABLE: Final[str] = (
7+
MSG_CATALOG_SERVICE_UNAVAILABLE: Final[str] = user_message(
68
# Most likely the director service is down or misconfigured so the user is asked to try again later.
79
"This service is temporarily unavailable. The incident was logged and will be investigated. "
810
+ MSG_TRY_AGAIN_OR_SUPPORT

services/web/server/src/simcore_service_webserver/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# main index route name = front-end
4141
INDEX_RESOURCE_NAME: Final[str] = "get_cached_frontend_index"
4242

43-
MSG_UNDER_DEVELOPMENT: Final[str] = (
43+
MSG_UNDER_DEVELOPMENT: Final[str] = user_message(
4444
"Under development. Use WEBSERVER_DEV_FEATURES_ENABLED=1 to enable current implementation"
4545
)
4646

services/web/server/src/simcore_service_webserver/invitations/errors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"""
2-
API plugin errors
2+
API plugin errors
33
"""
44

5+
from common_library.user_messages import user_message
56

67
from ..errors import WebServerBaseError
78

8-
MSG_INVALID_INVITATION_URL = "Link seems corrupted or incomplete"
9-
MSG_INVITATION_ALREADY_USED = "This invitation was already used"
9+
MSG_INVALID_INVITATION_URL = user_message("Link seems corrupted or incomplete")
10+
MSG_INVITATION_ALREADY_USED = user_message("This invitation was already used")
1011

1112

12-
class InvitationsError(WebServerBaseError, ValueError):
13-
...
13+
class InvitationsError(WebServerBaseError, ValueError): ...
1414

1515

1616
class InvalidInvitationError(InvitationsError):

services/web/server/src/simcore_service_webserver/payments/_onetime_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import arrow
77
from aiohttp import web
8+
from common_library.user_messages import user_message
89
from models_library.api_schemas_webserver.wallets import (
910
PaymentID,
1011
PaymentMethodID,
@@ -36,7 +37,9 @@
3637
_logger = logging.getLogger(__name__)
3738

3839

39-
MSG_WALLET_NO_ACCESS_ERROR = "User {user_id} does not have necessary permissions to do a payment into wallet {wallet_id}"
40+
MSG_WALLET_NO_ACCESS_ERROR = user_message(
41+
"User {user_id} does not have necessary permissions to do a payment into wallet {wallet_id}"
42+
)
4043
_FAKE_PAYMENT_TRANSACTION_ID_PREFIX = "fpt"
4144

4245

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from typing import Final
22

3+
from common_library.user_messages import user_message
4+
35
APP_RABBITMQ_CONSUMERS_KEY: Final[str] = f"{__name__}.rabbit_consumers"
46

5-
MSG_RESOURCE_USAGE_TRACKER_SERVICE_UNAVAILABLE: Final[
6-
str
7-
] = "Currently resource usage tracker service is unavailable, please try again later"
7+
MSG_RESOURCE_USAGE_TRACKER_SERVICE_UNAVAILABLE: Final[str] = user_message(
8+
"Currently resource usage tracker service is unavailable, please try again later"
9+
)
810

9-
MSG_RESOURCE_USAGE_TRACKER_NOT_FOUND: Final[str] = "Not Found"
11+
MSG_RESOURCE_USAGE_TRACKER_NOT_FOUND: Final[str] = user_message("Not Found")

services/web/server/src/simcore_service_webserver/security/_constants.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from typing import Final
2+
23
from common_library.user_messages import user_message
34

4-
MSG_UNAUTHORIZED: Final[str] = "Unauthorized"
5+
MSG_UNAUTHORIZED: Final[str] = user_message("Unauthorized")
56
MSG_AUTH_NOT_AVAILABLE: Final[str] = user_message(
67
"Authentication service is temporary unavailable"
78
)

services/web/server/src/simcore_service_webserver/studies_dispatcher/_constants.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
from typing import Final
22

3+
from common_library.user_messages import user_message
4+
35
#
46
# NOTE: MSG_$(ERROR_CODE_NAME) strings MUST be human readable messages
57
# Please keep alphabetical order
68
#
79

8-
MSG_PROJECT_NOT_FOUND: Final[str] = "Cannot find any study with ID '{project_id}'"
10+
MSG_PROJECT_NOT_FOUND: Final[str] = user_message(
11+
"Cannot find any study with ID '{project_id}'"
12+
)
913

1014
# This error happens when the linked study ID does not exists OR is not shared with everyone
11-
MSG_PROJECT_NOT_PUBLISHED: Final[str] = "Cannot find any study with ID '{project_id}'"
15+
MSG_PROJECT_NOT_PUBLISHED: Final[str] = user_message(
16+
"Cannot find any study with ID '{project_id}'"
17+
)
1218

1319
# This error happens when the linked study ID does not exists OR is not shared with everyone OR is NOT public
14-
MSG_PUBLIC_PROJECT_NOT_PUBLISHED: Final[str] = (
20+
MSG_PUBLIC_PROJECT_NOT_PUBLISHED: Final[str] = user_message(
1521
"Only available for registered users.<br/><br/>"
1622
"Please login and try again.<br/><br/>"
1723
"If you don't have an account, please request one at {support_email}<br/><br/>"
1824
)
1925

20-
MSG_GUESTS_NOT_ALLOWED: Final[str] = (
26+
MSG_GUESTS_NOT_ALLOWED: Final[str] = user_message(
2127
"Access restricted to registered users.<br/><br/>"
2228
"If you don't have an account, please email to support and request one<br/><br/>"
2329
)
2430

25-
MSG_TOO_MANY_GUESTS: Final[str] = (
31+
MSG_TOO_MANY_GUESTS: Final[str] = user_message(
2632
"We have reached the maximum of anonymous users allowed the platform. "
2733
"Please try later or login with a registered account."
2834
)
2935

30-
MSG_UNEXPECTED_DISPATCH_ERROR: Final[str] = (
36+
MSG_UNEXPECTED_DISPATCH_ERROR: Final[str] = user_message(
3137
"Sorry, but looks like something unexpected went wrong!"
3238
"We track these errors automatically, but if the problem persists feel free to contact us."
3339
"In the meantime, try refreshing."

services/web/server/src/simcore_service_webserver/utils_rate_limiting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import Final, NamedTuple
77

88
from aiohttp.web_exceptions import HTTPTooManyRequests
9+
from common_library.user_messages import user_message
910
from models_library.rest_error import EnvelopedError, ErrorGet
1011
from servicelib.aiohttp import status
1112

@@ -15,7 +16,7 @@ class RateLimitSetup(NamedTuple):
1516
interval_seconds: float
1617

1718

18-
MSG_TOO_MANY_REQUESTS: Final[str] = (
19+
MSG_TOO_MANY_REQUESTS: Final[str] = user_message(
1920
"Requests are being made too frequently. Please wait a moment before trying again."
2021
)
2122

0 commit comments

Comments
 (0)