aboutsummaryrefslogtreecommitdiff
path: root/www/trac-wikinotification
diff options
context:
space:
mode:
authorGreg Larkin <glarkin@FreeBSD.org>2010-10-08 16:55:08 +0000
committerGreg Larkin <glarkin@FreeBSD.org>2010-10-08 16:55:08 +0000
commit000ca138613c1c851508c965b1c8799544b9c451 (patch)
tree7bcf4040742e2b625abf34ab1c9967d71e7763c0 /www/trac-wikinotification
parentd0eec247f015314f860bd45d3dee2032ab98e471 (diff)
downloadports-000ca138613c1c851508c965b1c8799544b9c451.tar.gz
ports-000ca138613c1c851508c965b1c8799544b9c451.zip
Notes
Diffstat (limited to 'www/trac-wikinotification')
-rw-r--r--www/trac-wikinotification/Makefile2
-rw-r--r--www/trac-wikinotification/files/patch-WikiNotification__notification.py72
-rw-r--r--www/trac-wikinotification/files/patch-WikiNotification__templates__wiki_notification_email_template.txt59
3 files changed, 132 insertions, 1 deletions
diff --git a/www/trac-wikinotification/Makefile b/www/trac-wikinotification/Makefile
index 9d4fa58d6555..2e8be9761ad3 100644
--- a/www/trac-wikinotification/Makefile
+++ b/www/trac-wikinotification/Makefile
@@ -7,7 +7,7 @@
PORTNAME= wikinotificationplugin
PORTVERSION= 0.2.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= www devel python
MASTER_SITES= ${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= brooks
diff --git a/www/trac-wikinotification/files/patch-WikiNotification__notification.py b/www/trac-wikinotification/files/patch-WikiNotification__notification.py
new file mode 100644
index 000000000000..2b9e322cfcc0
--- /dev/null
+++ b/www/trac-wikinotification/files/patch-WikiNotification__notification.py
@@ -0,0 +1,72 @@
+--- ./WikiNotification/notification.py.orig 2008-03-14 05:02:03.000000000 -0400
++++ ./WikiNotification/notification.py 2010-10-08 11:41:19.000000000 -0400
+@@ -21,7 +21,7 @@
+ from trac.util.text import CRLF
+ from trac.wiki.model import WikiPage
+ from trac.versioncontrol.diff import unified_diff
+-from trac.notification import NotifyEmail
++from trac.notification import NotifyEmail, NotificationSystem
+ from trac.config import Option, BoolOption, ListOption, IntOption
+
+ from genshi.template.text import TextTemplate
+@@ -33,6 +33,7 @@
+ +++ %(name)s (version: %(version)s)
+ """
+
++
+ class WikiNotificationSystem(Component):
+ smtp_from = Option(
+ 'wiki-notification', 'smtp_from', 'trac+wiki@localhost',
+@@ -131,7 +132,7 @@
+ if page.version > 0 and action == 'modified':
+ diff = diff_header % {'name': self.page.name,
+ 'version': self.page.version,
+- 'oldversion': self.page.version -1
++ 'oldversion': self.page.version -1,
+ }
+ oldpage = WikiPage(self.env, page.name, page.version - 1)
+ self.data["oldversion"]= oldpage.version
+@@ -183,8 +184,8 @@
+ public_cc = self.config.getbool('wiki-notification', 'use_public_cc')
+ headers = {}
+ headers['X-Mailer'] = 'Trac %s, by Edgewall Software' % __version__
+- headers['X-Trac-Version'] = __version__
+- headers['X-Trac-Project'] = projname
++ headers['X-Trac-Version'] = __version__
++ headers['X-Trac-Project'] = projname
+ headers['X-URL'] = self.config.get('project', 'url')
+ headers['Precedence'] = 'bulk'
+ headers['Auto-Submitted'] = 'auto-generated'
+@@ -284,18 +285,16 @@
+ del msg['Content-Transfer-Encoding']
+ msg.set_charset(self._charset)
+
+- self.add_headers(msg, headers);
+- self.add_headers(msg, mime_headers);
+- self.env.log.info("Sending SMTP notification to %s:%d to %s"
+- % (self.smtp_server, self.smtp_port, recipients))
++ self.add_headers(msg, headers)
++ self.add_headers(msg, mime_headers)
++ self.env.log.info("Sending SMTP notification to %s"
++ % str(recipients))
+ msgtext = msg.as_string()
+ # Ensure the message complies with RFC2822: use CRLF line endings
+ recrlf = re.compile("\r?\n")
+ msgtext = CRLF.join(recrlf.split(msgtext))
+- try:
+- self.server.sendmail(msg['From'], recipients, msgtext)
+- except Exception, err:
+- self.env.log.debug('Notification could not be sent: %r', err)
++ NotificationSystem(self.env).send_email(self.from_email, recipients,
++ msgtext)
+
+ def format_subject(self, action):
+ template = self.config.get('wiki-notification', 'subject_template')
+@@ -308,6 +307,6 @@
+ data = {
+ 'page': self.page,
+ 'prefix': prefix,
+- 'action': action
++ 'action': action,
+ }
+ return template.generate(**data).render('text', encoding=None).strip()
diff --git a/www/trac-wikinotification/files/patch-WikiNotification__templates__wiki_notification_email_template.txt b/www/trac-wikinotification/files/patch-WikiNotification__templates__wiki_notification_email_template.txt
new file mode 100644
index 000000000000..77641e7072bb
--- /dev/null
+++ b/www/trac-wikinotification/files/patch-WikiNotification__templates__wiki_notification_email_template.txt
@@ -0,0 +1,59 @@
+--- ./WikiNotification/templates/wiki_notification_email_template.txt.orig 2008-03-14 05:02:03.000000000 -0400
++++ ./WikiNotification/templates/wiki_notification_email_template.txt 2010-10-08 11:41:19.000000000 -0400
+@@ -1,40 +1,40 @@
+
+-#if action == 'added'
++{% if action == 'added' %}
+ Added page "${name}" by ${author} from ${ip}*
+ Page URL: <${link}>
+- #if comment
++ {% if comment %}
+ Comment: ${comment}
+- #end
++ {% end %}
+ Content:
+ -------8<------8<------8<------8<------8<------8<------8<------8<--------
+ ${text}
+ -------8<------8<------8<------8<------8<------8<------8<------8<--------
+-#end
+-#if action == 'modified'
++{% end %}
++{% if action == 'modified' %}
+ Changed page "${name}" by ${author} from ${ip}*
+ Page URL: <${link}>
+ Diff URL: <${linkdiff}>
+ Revision ${version}
+- #if comment
++ {% if comment %}
+ Comment: ${comment}
+- #end
++ {% end %}
+
+- #if wikidiff!=None
++ {% if wikidiff!=None %}
+ -------8<------8<------8<------8<------8<------8<------8<------8<--------
+ ${wikidiff}
+ -------8<------8<------8<------8<------8<------8<------8<------8<--------
+- #end
+- #if wikidiff==None
++ {% end %}
++ {% if wikidiff==None %}
+ Changes on attached ${name}.diff file.
+- #end
+-#end
+-#if action == 'deleted'
++ {% end %}
++{% end %}
++{% if action == 'deleted' %}
+ Deleted page "${name}" by ${author} from ${ip}*
+-#end
+-#if action == 'deleted_version'
++{% end %}
++{% if action == 'deleted_version' %}
+ Page URL: <${link}>
+ Deleted version "${version}" of page "${name}" by ${author} from ${ip}*
+-#end
++{% end %}
+
+ * The IP shown here might not mean anything if the user or the server is
+ behind a proxy.