Features: 1) Add type annotations in validate method of serializers for improved clarity.
Fixes: 1) Correct type signature in `validate` method for serializers. Extra: 1) Remove redundant worker log format configurations in Celery; 2) Simplify log message format in log configuration for conciseness.
This commit is contained in:
parent
1630288e2e
commit
fabb3b5866
3 changed files with 3 additions and 5 deletions
|
|
@ -210,7 +210,7 @@ class TokenRefreshSerializer(Serializer):
|
|||
def validate(self, attrs: dict[str, Any]) -> dict[str, str]:
|
||||
refresh = self.token_class(attrs["refresh"])
|
||||
|
||||
data = {"access": str(refresh.access_token)}
|
||||
data: dict[str, str | dict[str, Any]] = {"access": str(refresh.access_token)}
|
||||
|
||||
if api_settings.ROTATE_REFRESH_TOKENS:
|
||||
if api_settings.BLACKLIST_AFTER_ROTATION:
|
||||
|
|
@ -241,7 +241,7 @@ class TokenVerifySerializer(Serializer):
|
|||
|
||||
self.retrieve_user: bool = retrieve_user
|
||||
|
||||
def validate(self, attrs: dict[str, None]) -> dict[Any, Any]:
|
||||
def validate(self, attrs: dict[str, Any]) -> dict[Any, Any]:
|
||||
token = UntypedToken(attrs["token"])
|
||||
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ app = Celery("evibes")
|
|||
|
||||
app.conf.update(
|
||||
worker_hijack_root_logger=False,
|
||||
worker_log_format="[%(asctime)s: %(levelname)s/%(processName)s] %(name)s: %(message)s",
|
||||
worker_task_log_format="[%(asctime)s: %(levelname)s/%(processName)s] %(name)s: %(message)s",
|
||||
broker_connection_retry_on_startup=True,
|
||||
task_serializer="json",
|
||||
result_serializer="json",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ LOGGING = {
|
|||
"formatters": {
|
||||
"color": {
|
||||
"()": "colorlog.ColoredFormatter",
|
||||
"format": "%(asctime)s %(log_color)s[%(levelname)s]%(reset)s %(name)s:%(module)s:%(lineno)d: %(message)s",
|
||||
"format": "%(asctime)s %(log_color)s[%(levelname)s]%(reset)s: %(message)s",
|
||||
"datefmt": "%Y-%m-%d %H:%M:%S",
|
||||
"log_colors": {
|
||||
"DEBUG": "cyan",
|
||||
|
|
|
|||
Loading…
Reference in a new issue