From 3ec1020ae42826e522129ca5265a6c62d0cdf3c8 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Sun, 29 Aug 2010 15:17:01 +0400 Subject: [PATCH] www/trac-wikinotification: update the port for Trac 0.12 - the patch that allows the plugin not to break e-mail sending via backtrace was taken from http://wikinotification.ufsoft.org/ticket/100 - Genshi syntax was updated to the new variant, because it seems that the support for the old one was dropped in Trac 0.12. Signed-off-by: Eygene Ryabinkin --- www/trac-wikinotification/Makefile | 2 +- .../files/patch-new-genshi-syntax | 62 ++++++++++++++++ www/trac-wikinotification/files/patch-trac-0.12 | 77 ++++++++++++++++++++ 3 files changed, 140 insertions(+), 1 deletions(-) create mode 100644 www/trac-wikinotification/files/patch-new-genshi-syntax create mode 100644 www/trac-wikinotification/files/patch-trac-0.12 diff --git a/www/trac-wikinotification/Makefile b/www/trac-wikinotification/Makefile index 96cc4e1..03c7202 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-new-genshi-syntax b/www/trac-wikinotification/files/patch-new-genshi-syntax new file mode 100644 index 0000000..619a73f --- /dev/null +++ b/www/trac-wikinotification/files/patch-new-genshi-syntax @@ -0,0 +1,62 @@ +Use new Genshi syntax that was introduced in 0.5 at 2008-06-09, +so it is not so new at all ;)) + +--- WikiNotification/templates/wiki_notification_email_template.txt.orig 2010-08-27 12:13:27.000000000 +0400 ++++ WikiNotification/templates/wiki_notification_email_template.txt 2010-08-27 12:15:02.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. diff --git a/www/trac-wikinotification/files/patch-trac-0.12 b/www/trac-wikinotification/files/patch-trac-0.12 new file mode 100644 index 0000000..4567748 --- /dev/null +++ b/www/trac-wikinotification/files/patch-trac-0.12 @@ -0,0 +1,77 @@ +Taken-From: http://wikinotification.ufsoft.org/ticket/100 + +Index: WikiNotification/notification.py +================================================================== +--- a/WikiNotification/notification.py Wed Mar 11 21:10:23 2009 +0000 ++++ b/WikiNotification/notification.py Fri May 07 17:20:03 2010 +0200 +@@ -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() + -- 1.7.2.1