Changeset - e50961288e80
[Not reviewed]
0 1 0
Lance Edgar (lance) - 20 months ago 2023-02-17 13:21:42
lance@edbob.org
Avoid/delay import in case SQLAlchemy not installed
1 file changed with 4 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rattail/emails.py
Show inline comments
 
@@ -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],
 
        }
0 comments (0 inline, 0 general)