incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [1/4] git commit: [#6105] ticket:348 Remove unnecessary escaping
Date Thu, 23 May 2013 13:34:47 GMT
Updated Branches:
  refs/heads/master 760cf5ee1 -> b5bca03bc


[#6105] ticket:348 Remove unnecessary escaping


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b5bca03b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b5bca03b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b5bca03b

Branch: refs/heads/master
Commit: b5bca03bc5aa4da9173a49ce854150034af09359
Parents: 76a1f1e
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Tue May 7 12:16:55 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu May 23 13:34:16 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/macro.py          |    5 ++---
 Allura/allura/tests/test_globals.py |   14 ++++++++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5bca03b/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 88db722..1e6c353 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -23,7 +23,6 @@ import traceback
 from operator import attrgetter
 
 import pymongo
-import jinja2
 from pylons import tmpl_context as c, app_globals as g
 from pylons import request
 from paste.deploy.converters import asint
@@ -346,7 +345,7 @@ def project_admins():
     from allura.lib.widgets.macros import ProjectAdmins
     output = ((dict(
             url=user.url(),
-            name=jinja2.escape(user.display_name)))
+            name=user.display_name))
         for user in admins)
     users = ProjectAdmins(users=output)
     g.resource_manager.register(users)
@@ -361,7 +360,7 @@ def members(limit=20):
     members = sorted(c.project.users(), key=attrgetter('display_name'))
     output = [dict(
             url=user.url(),
-            name=jinja2.escape(user.display_name),
+            name=user.display_name,
             admin=' (admin)' if user in admins else '',
             )
         for user in members[:limit]]

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b5bca03b/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index c1c221a..b4df060 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -183,11 +183,21 @@ def test_macro_members():
         '</div>')
 
 @with_setup(teardown=setUp) # reset everything we changed
+def test_macro_members_escaping():
+    user = M.User.by_username('test-admin')
+    user.display_name = u'Test Admin <script>'
+    r = g.markdown_wiki.convert('[[members]]')
+    assert_equal(r, u'<div class="markdown_content"><h6>Project Members:</h6>\n'
+        u'<ul class="md-users-list">\n'
+        u'<li><a href="/u/test-admin/">Test Admin &lt;script&gt;</a>
(admin)</li>\n'
+        u'</ul>\n</div>')
+
+@with_setup(teardown=setUp) # reset everything we changed
 def test_macro_project_admins():
     user = M.User.by_username('test-admin')
-    user.display_name = u'Test Ådmin'
+    user.display_name = u'Test Ådmin <script>'
     r = g.markdown_wiki.convert('[[project_admins]]')
-    assert_equal(r, u'<div class="markdown_content"><h6>Project Admins:</h6>\n<ul
class="md-users-list">\n<li><a href="/u/test-admin/">Test \xc5dmin</a></li>\n</ul>\n</div>')
+    assert_equal(r, u'<div class="markdown_content"><h6>Project Admins:</h6>\n<ul
class="md-users-list">\n<li><a href="/u/test-admin/">Test \xc5dmin &lt;script&gt;</a></li>\n</ul>\n</div>')
 
 @with_setup(teardown=setUp) # reset everything we changed
 def test_macro_project_admins_one_br():


Mime
View raw message