def setUp(self): global _global_signal_recorder self.client = Client() seconds = datetime.datetime.now().microsecond self.user = User(username="******" % seconds, email="*****@*****.**", is_active=True) self.user.set_password('password') self.user.save() self.client.login(username=self.user.username, password='******') issue_created.connect(self.onIssueCreated, dispatch_uid='djtracker.SignalTest.issue_created') issue_updated.connect(self.onIssueUpdated, dispatch_uid='djtracker.SignalTest.issue_updated') issue_commented.connect(self.onIssueCommented, dispatch_uid='djtracker.SignalTest.issue_commented') _global_signal_recorder = []
msg.to = [recipient,] msg.send(fail_silently=True) def notify_issue_created(sender, issue, request, **kwargs): context = _get_notification_context(issue, request) template = utils.MailTemplate('djtracker/mail/issue_created.mail') _send_notifications(template, context) def notify_issue_updated(sender, issue, updated_fields, request, **kwargs): context = _get_notification_context(issue, request) context['updated_fields'] = updated_fields template = utils.MailTemplate('djtracker/mail/issue_updated.mail') _send_notifications(template, context) def notify_issue_commented(sender, comment, issue, status_change, request, **kwargs): context = _get_notification_context(issue, request) context['comment'] = comment context['comment_user_name'] = comment.user_name context['status_change'] = status_change template = utils.MailTemplate('djtracker/mail/issue_commented.mail') _send_notifications(template, context) post_save.connect(create_profile, sender=User) issue_created.connect(notify_issue_created, dispatch_uid='djtracker.notify_issue_created') issue_updated.connect(notify_issue_updated, dispatch_uid='djtracker.notify_issue_updated') issue_commented.connect(notify_issue_commented, dispatch_uid='djtracker.notify_issue_commented') if not hasattr(settings, "WEB_SERVER"): settings.WEB_SERVER = 'apache'