Permalink
Browse files

restore support for trac 0.11.7 (tested) and 0.12 -- the signature of…

… trac's internal function NotifyEmail.notify, which i use here, changed in 0.13
  • Loading branch information...
1 parent c787228 commit 46576fe04756ea833108f1268de57d5a4dc7110b @ejucovy ejucovy committed Dec 12, 2012
Showing with 16 additions and 4 deletions.
  1. +5 −0 CHANGES.txt
  2. +1 −1 setup.py
  3. +10 −3 workflow_notification/__init__.py
View
@@ -1,3 +1,8 @@
+0.4 (2012-12-12)
+----------------
+
+ * Support for Trac 0.11.7
+
0.3 (2012-12-11)
----------------
View
@@ -10,7 +10,7 @@
pass
setup(name='trac-WorkflowNotificationPlugin',
- version='0.2',
+ version='0.4',
description="Configurable notifications for trac tickets tied to workflow actions",
long_description=long_description,
packages=['workflow_notification'],
@@ -72,9 +72,16 @@ def notify(self, req, ticket, name):
).generate(**ctx).render(encoding=None)
recipients = [r.strip() for r in recipients.split(",")]
- WorkflowNotifyEmail(self.env, template_name='ticket_notify_workflow_email.txt',
- recipients=recipients, data={'body': body}).notify(
- ticket.id, subject, req.authname)
+ notifier = WorkflowNotifyEmail(
+ self.env, template_name='ticket_notify_workflow_email.txt',
+ recipients=recipients, data={'body': body})
+
+ arity = len(inspect.getargspec(notifier.notify)[0])
+ if arity == 3: # Trac 0.12 and below
+ args = [ticket.id, subject]
+ elif arity == 4: # Trac 0.13 and up have an additional `author` argument to trac.notification:NotifyEmail.notify
+ args = [ticket.id, subject, req.authname]
+ notifier.notify(*args)
# ITicketActionController methods

0 comments on commit 46576fe

Please sign in to comment.