From f47d0b1a407096423c36fbed806f4f8c1496cf68 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 18 Apr 2023 18:56:17 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=B7=A5=E5=8D=95=E5=8F=91=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=A4=B1=E8=B4=A5=20(#10242)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: feng <1304903146@qq.com> --- apps/common/db/encoder.py | 10 +++++----- apps/tickets/notifications.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/common/db/encoder.py b/apps/common/db/encoder.py index e09ffd60e..d773491a1 100644 --- a/apps/common/db/encoder.py +++ b/apps/common/db/encoder.py @@ -1,12 +1,12 @@ import json -import uuid import logging +import uuid from datetime import datetime -from django.utils.translation import ugettext_lazy as _ -from django.utils import timezone as dj_timezone -from django.db import models from django.conf import settings +from django.db import models +from django.utils import timezone as dj_timezone +from django.utils.translation import ugettext_lazy as _ lazy_type = type(_('ugettext_lazy')) @@ -28,5 +28,5 @@ class ModelJSONFieldEncoder(json.JSONEncoder): try: return super().default(obj) except TypeError: - logging.error('Type error: ', type(obj)) + logging.error(f'Type error: {type(obj)}') return str(obj) diff --git a/apps/tickets/notifications.py b/apps/tickets/notifications.py index 7e971f4cf..5da077496 100644 --- a/apps/tickets/notifications.py +++ b/apps/tickets/notifications.py @@ -3,16 +3,16 @@ from urllib.parse import urljoin from django.conf import settings from django.core.cache import cache -from django.shortcuts import reverse from django.forms import model_to_dict +from django.shortcuts import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ -from notifications.notifications import UserMessage -from common.utils import get_logger, random_string from common.db.encoder import ModelJSONFieldEncoder -from .models import Ticket +from common.utils import get_logger, random_string +from notifications.notifications import UserMessage from . import const +from .models import Ticket logger = get_logger(__file__)