more fixes on templated mail and safe context

This commit is contained in:
Alex Garel 2011-11-09 16:37:37 +01:00
parent 08efeb1fc9
commit ab84017dd5
4 changed files with 14 additions and 27 deletions

View File

@ -13,12 +13,12 @@ import getopt
from optparse import make_option
import sys
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from django.utils.translation import ugettext as _
from helpdesk.models import Queue, Ticket, FollowUp, EscalationExclusion, TicketChange
from helpdesk.lib import send_templated_mail
from helpdesk.lib import send_templated_mail, safe_template_context
class Command(BaseCommand):
@ -99,10 +99,7 @@ def escalate_tickets(queues, verbose):
t.priority -= 1
t.save()
context = {
'ticket': t,
'queue': q,
}
context = safe_template_context(t)
if t.submitter_email:
send_templated_mail(

View File

@ -26,7 +26,7 @@ from django.core.management.base import BaseCommand
from django.db.models import Q
from django.utils.translation import ugettext as _
from helpdesk.lib import send_templated_mail
from helpdesk.lib import send_templated_mail, safe_template_context
from helpdesk.models import Queue, Ticket, FollowUp, Attachment, IgnoreEmail
@ -246,10 +246,7 @@ def ticket_from_message(message, queue, quiet):
t.status = Ticket.REOPENED_STATUS
t.save()
context = {
'ticket': t,
'queue': queue,
}
context = safe_template_context(t)
if new:

View File

@ -22,7 +22,7 @@ from django.template import loader, Context
from django.utils import simplejson
from helpdesk.forms import TicketForm
from helpdesk.lib import send_templated_mail
from helpdesk.lib import send_templated_mail, safe_template_context
from helpdesk.models import Ticket, Queue, FollowUp
STATUS_OK = 200
@ -191,11 +191,8 @@ class API:
f.save()
context = {
'ticket': ticket,
'queue': ticket.queue,
'comment': f.comment,
}
context = safe_template_context(ticket)
context['comment'] = f.comment
messages_sent_to = []
@ -266,11 +263,8 @@ class API:
)
f.save()
context = {
'ticket': ticket,
'queue': ticket.queue,
'resolution': f.comment,
}
context = safe_template_context(ticket)
context['resolution'] = f.comment
subject = '%s %s (Resolved)' % (ticket.ticket, ticket.title)

View File

@ -419,11 +419,10 @@ def mass_update(request):
f = FollowUp(ticket=t, date=datetime.now(), title=_('Closed in bulk update'), public=True, user=request.user, new_status=Ticket.CLOSED_STATUS)
f.save()
# Send email to Submitter, Owner, Queue CC
context = {
'ticket': t,
'queue': t.queue,
'resolution': t.resolution,
}
context = safe_template_context(t)
context.update(
resolution=t.resolution,
)
messages_sent_to = []