Minor fixes on notification system.

remotes/origin/enhancement/email-actions
Andrey Antukh 2013-07-17 19:20:48 +02:00
parent 5fe54263b1
commit 81024ec63f
3 changed files with 8 additions and 6 deletions

View File

@ -8,7 +8,7 @@ class NotificationSenderMixin(object):
update_notification_template = None
destroy_notification_template = None
def _send_notification_email(template_method, users=None, context=None):
def _send_notification_email(self, template_method, users=None, context=None):
mails = template_mail.MagicMailBuilder()
for user in users:
email = getattr(mails, template_method)(user, context)
@ -28,6 +28,7 @@ class NotificationSenderMixin(object):
self._send_notification_email(self.update_notification_template, users=users, context=context)
def destroy(self, request, *args, **kwargs):
obj = self.get_object()
users = obj.get_watchers_to_notify(self.request.user)
context = {
'changer': self.request.user,

View File

@ -64,8 +64,8 @@ class WatchedMixin(object):
return version_list and version_list[0] or None
def get_changed_fields_dict(self, data_dict):
if self.notified_fields:
changed_data = dict((k, d[k]) for k in data_dict if k in self.notifiable_fields)
if self.notifiable_fields:
changed_data = dict((k, v) for k, v in data_dict.items() if k in self.notifiable_fields)
else:
changed_data = data_dict

View File

@ -81,8 +81,8 @@ class Command(BaseCommand):
bug = self.create_bug(project)
# create questions.
for y in xrange(self.sd.int(15,25)):
question = self.create_question(project)
#for y in xrange(self.sd.int(15,25)):
# question = self.create_question(project)
def create_question(self, project):
question = Question.objects.create(
@ -163,9 +163,10 @@ class Command(BaseCommand):
points=points,
role=role)
for tag in self.sd.words().split(" "):
for tag in self.sd.words(1, 3).split(" "):
us.tags.append(tag)
us.save()
return us
def create_milestone(self, project, start_date, end_date):