Version 0.5.5.93: custom fields in lists, MeshCentral sync flag for statuses
- Show custom field values in asset list, dashboard and list Excel export - New status flag to exclude assets (e.g. scrapped) from MeshCentral sync - Require a secure SESSION_SECRET with a readable startup message - Add SESSION_COOKIE_SECURE and refresh session permissions per request - Translate HTTP errors and remaining fixed UI texts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c3f1ef43db
commit
261b4f2029
35 files changed
+768
-308
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from typing import Any
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
|
||||
class TranslatedHTTPException(HTTPException):
|
||||
"""HTTP error carrying a translation key instead of fixed text.
|
||||
|
||||
The application exception handler translates the key into the language of
|
||||
the current user. ``detail`` holds the English default so handlers without
|
||||
translation support (for example the callback-only service) still return
|
||||
readable text.
|
||||
"""
|
||||
|
||||
def __init__(self, status_code: int, key: str, default: str, **values: Any) -> None:
|
||||
try:
|
||||
detail = default.format(**values)
|
||||
except (KeyError, ValueError):
|
||||
detail = default
|
||||
super().__init__(status_code, detail)
|
||||
self.translation_key = key
|
||||
self.translation_default = default
|
||||
self.translation_values = values
|
||||
Reference in new issue
Block a user