allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [3/6] git commit: [#5481] ticket:313 fixed @, html and tests
Date Fri, 12 Apr 2013 21:16:33 GMT
[#5481] ticket:313 fixed @, html and  tests


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

Branch: refs/heads/cj/5481
Commit: c2b304cfc4b62f2d668d28642da24555ac604c15
Parents: 5a8f06e
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Sun Apr 7 23:53:15 2013 +0400
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Apr 12 17:16:16 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/project.py        |   18 +++++++-----------
 Allura/allura/lib/macro.py                  |    4 ++--
 Allura/allura/templates/members.html        |   10 +++++-----
 Allura/allura/tests/functional/test_home.py |   14 +++++++-------
 Allura/allura/tests/test_globals.py         |    4 +---
 5 files changed, 22 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c2b304cf/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index f91c543..6a05acf 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -322,18 +322,14 @@ class ProjectController(object):
     def _members(self, **kw):
         users = []
         for user in c.project.users():
-            roles = []
-            for role in user.project_role().roles:
-                r = M.ProjectRole.query.get(_id=role)
-                if r.name not in roles:
-                    roles.append(r.name)
+            roles = M.ProjectRole.query.find({'_id': {'$in': user.project_role().roles}})
+            roles = set([r.name for r in roles])
             users.append(dict(
-                display_name = user.display_name,
-                username = user.username,
-                url = user.url(),
-                roles = roles,
-                email_addresses = user.email_addresses,
-                skills = user.get_skills()))
+                display_name=user.display_name,
+                username=user.username,
+                url=user.url(),
+                roles=roles,
+                email_addresses=user.email_addresses))
         return dict(users=users)
 
     def _check_security(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c2b304cf/Allura/allura/lib/macro.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/macro.py b/Allura/allura/lib/macro.py
index 4615828..829897b 100644
--- a/Allura/allura/lib/macro.py
+++ b/Allura/allura/lib/macro.py
@@ -345,12 +345,12 @@ def project_admins():
                 url=user_role.user.url(),
                 name=user_role.user.display_name))
             for user_role in admin_role.users_with_role())
-    return u'<p>Project Admins:<br/>{}</p>'.format(output)
+    return u'<h6>Project Admins:</h6><p>{}</p>'.format(output)
 
 template_members = string.Template('<a href="$url">Members</a><br/>')
 @macro()
 def members():
     output = ''.join(
             template_members.substitute(dict(
-                url=urljoin(c.project.url(),'_members'),)))
+                url=urljoin(c.project.url(), '_members'),)))
     return u'<p>{}</p>'.format(output)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c2b304cf/Allura/allura/templates/members.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/members.html b/Allura/allura/templates/members.html
index 06d353a..468d14c 100644
--- a/Allura/allura/templates/members.html
+++ b/Allura/allura/templates/members.html
@@ -8,7 +8,7 @@
 <table>
     <thead>
     <tr>
-        <th >Developer</th>
+        <th>Developer</th>
         <th>Username</th>
         <th>Role/Position</th>
         <th>Email</th>
@@ -16,10 +16,10 @@
     </thead>
     {%for user in users%}
     <tr>
-        <td >{{ user.display_name }}</td>
-        <td ><a href="{{ user.url }}">{{ user.username }}</a></td>
-        <td >{% for role in user.roles%} {{ role }}</br> {%endfor%}</td>
-        <td >{% for email in user.email_addresses %}{{email}}{%endfor%}</td>
+        <td>{{ user.display_name }}</td>
+        <td><a href="{{ user.url }}">{{ user.username }}</a></td>
+        <td>{% for role in user.roles%} {{ role }}</br> {%endfor%}</td>
+        <td>{% for email in user.email_addresses %}{{email.replace('@', ' at ')}}{%endfor%}</td>
     </tr>
     {%endfor%}
 </table>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c2b304cf/Allura/allura/tests/functional/test_home.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_home.py b/Allura/allura/tests/functional/test_home.py
index 921da96..a4f2f84 100644
--- a/Allura/allura/tests/functional/test_home.py
+++ b/Allura/allura/tests/functional/test_home.py
@@ -59,14 +59,14 @@ class TestProjectHome(TestController):
 
     def test_members(self):
         r = self.app.get('/p/test/_members/')
-        assert '<td >Test Admin</td>' in r
-        assert '<td ><a href="/u/test-admin/">test-admin</a></td>'
in r
-        assert '<td > Admin</br> </td>' in r
-        assert '<td >test-admin@users.localhost</td>' in r
+        assert '<td>Test Admin</td>' in r
+        assert '<td><a href="/u/test-admin/">test-admin</a></td>'
in r
+        assert '<td> Admin</br> </td>' in r
+        assert '<td>test-admin at users.localhost</td>' in r
 
     def test_members_anonymous(self):
         r = self.app.get('/p/test/_members/', extra_environ=dict(username='*anonymous'))
-        assert '<td >Test Admin</td>' in r
-        assert '<td ><a href="/u/test-admin/">test-admin</a></td>'
in r
-        assert '<td > Admin</br> </td>' in r
+        assert '<td>Test Admin</td>' in r
+        assert '<td><a href="/u/test-admin/">test-admin</a></td>'
in r
+        assert '<td> Admin</br> </td>' in r
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c2b304cf/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 4fa37cc..e52c00c 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -150,8 +150,6 @@ def test_macros():
     assert 'test content' in r
 
 def test_macro_members():
-    user = M.User.by_username('test-admin')
-    user.display_name = u'Test Ådmin'
     r = g.markdown_wiki.convert('[[members]]')
     assert_equal(r, u'<div class="markdown_content"><p><a href="/p/test/_members">Members</a><br
/></p>\n</div>')
 
@@ -159,7 +157,7 @@ def test_macro_project_admins():
     user = M.User.by_username('test-admin')
     user.display_name = u'Test Ådmin'
     r = g.markdown_wiki.convert('[[project_admins]]')
-    assert_equal(r, u'<div class="markdown_content"><p>Project Admins:<br
/><a href="/u/test-admin/">Test Ådmin</a><br /></p>\n</div>')
+    assert_equal(r, u'<div class="markdown_content"><h6>Project Admins:</h6><p><a
href="/u/test-admin/">Test Ådmin</a><br /></p>\n</div>')
 
 def test_macro_project_admins_one_br():
     p_nbhd = M.Neighborhood.query.get(name='Projects')


Mime
View raw message