diff options
author | glarkin <glarkin@FreeBSD.org> | 2010-10-09 00:55:08 +0800 |
---|---|---|
committer | glarkin <glarkin@FreeBSD.org> | 2010-10-09 00:55:08 +0800 |
commit | cd1ccf8197217dfffff6f3705674a02b10df2814 (patch) | |
tree | 57a49e9de226f98878dc9ac7694cb46fdaefb037 /www | |
parent | 89be38798106963936d57d8484f82b539776dda1 (diff) | |
download | freebsd-ports-gnome-cd1ccf8197217dfffff6f3705674a02b10df2814.tar.gz freebsd-ports-gnome-cd1ccf8197217dfffff6f3705674a02b10df2814.tar.zst freebsd-ports-gnome-cd1ccf8197217dfffff6f3705674a02b10df2814.zip |
- Fixed unknown variable InternalError when used with Trac 0.12
- Fixed formatting of wiki notification email when used with Trac 0.12
PR: ports/150084
Submitted by: Eygene Ryabinkin <rea-fbsd at codelabs dot ru>
Approved by: glarkin (maintainer)
Diffstat (limited to 'www')
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. |