linamh/www-apps/trac-acct_mgr/files/replaceMessageWrapper-with-genshi-markup-against-0.11-branch.patch

66 lines
2.7 KiB
Diff
Raw Normal View History

Index: acct_mgr/web_ui.py
===================================================================
--- acct_mgr/web_ui.py (revision 5267)
+++ acct_mgr/web_ui.py (working copy)
@@ -24,6 +24,7 @@
from trac.web.main import IRequestHandler, IRequestFilter
from trac.web import chrome
from trac.web.chrome import INavigationContributor, ITemplateProvider
+from genshi.core import Markup
from genshi.builder import tag
from api import AccountManager
@@ -239,7 +240,7 @@
if force_change_password:
del(req.session['force_change_passwd'])
req.session.save()
- chrome.add_notice(req, MessageWrapper(tag(
+ chrome.add_notice(req, Markup(tag(
"Thank you for taking the time to update your password."
)))
force_change_password = False
@@ -248,7 +249,7 @@
else:
data.update({'error': 'Invalid action'})
if force_change_password:
- chrome.add_warning(req, MessageWrapper(tag(
+ chrome.add_warning(req, Markup(tag(
"You are required to change password because of a recent "
"password change request. ",
tag.b("Please change your password now."))))
@@ -507,16 +508,6 @@
return [resource_filename(__name__, 'templates')]
-class MessageWrapper(object):
- """Wrapper for add_warning and add_notice to work around the requirement
- for a % operator."""
- def __init__(self, body):
- self.body = body
-
- def __mod__(self, rhs):
- return self.body
-
-
class EmailVerificationNotification(SingleUserNofification):
template_name = 'verify_email.txt'
@@ -549,7 +540,7 @@
# tickets. As such, this email verifying code won't be used on them
return handler
if handler is not self and 'email_verification_token' in req.session:
- chrome.add_warning(req, MessageWrapper(tag.span(
+ chrome.add_warning(req, Markup(tag.span(
'Your permissions have been limited until you ',
tag.a(href=req.href.verify_email())(
'verify your email address'))))
@@ -566,7 +557,7 @@
req.session['email_verification_token'] = self._gen_token()
req.session['email_verification_sent_to'] = req.session.get('email')
self._send_email(req)
- chrome.add_notice(req, MessageWrapper(tag.span(
+ chrome.add_notice(req, Markup(tag.span(
'An email has been sent to ', req.session['email'],
' with a token to ',
tag.a(href=req.href.verify_email())(