From e50961288e8072213ab5356ca6b2aef633038a25 2023-02-17 13:21:42 From: Lance Edgar Date: 2023-02-17 13:21:42 Subject: [PATCH] Avoid/delay import in case SQLAlchemy not installed --- diff --git a/rattail/emails.py b/rattail/emails.py index 3fa29bd5dc2b808068ce37ac08a3d1ac6bf671ac..7adffddd88fd1d49ed3e32e90667ab545f611197 100644 --- a/rattail/emails.py +++ b/rattail/emails.py @@ -24,20 +24,15 @@ Common email config objects """ -from __future__ import unicode_literals, absolute_import - import datetime import sys import socket from traceback import format_exception -import six - from rattail.mail import Email from rattail.util import load_object from rattail.core import Object from rattail.time import make_utc, localtime -from rattail.problems import ProblemReport, get_problem_report_handler class ProblemReportEmail(Email): @@ -47,6 +42,8 @@ class ProblemReportEmail(Email): abstract = True def obtain_sample_data(self, request): + from rattail.problems import ProblemReport, get_problem_report_handler + data = self.sample_data(request) handler = get_problem_report_handler(self.config) @@ -245,7 +242,7 @@ class ImporterEmail(Email): [], # deleted ), }, - 'render_record': lambda x: six.text_type(x), + 'render_record': lambda x: str(x), 'max_display': 15, } @@ -392,7 +389,7 @@ class trainwreck_problems_missing_dbs(ProblemReportEmail): abstract = False def sample_data(self, request): - next_year = six.text_type(self.app.today().year + 1) + next_year = str(self.app.today().year + 1) return { 'problems': [next_year], }