allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [23/33] git commit: [#6392] ticket:403 code refactoring
Date Tue, 24 Sep 2013 19:37:59 GMT
[#6392] ticket:403 code refactoring


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

Branch: refs/heads/cj/6695
Commit: 9442d72b668779887952ca9f7bd844fd62abb9f1
Parents: 5303715
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Fri Aug 9 13:59:33 2013 +0300
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Sep 24 17:36:24 2013 +0000

----------------------------------------------------------------------
 Allura/allura/app.py                                    | 12 ++++++------
 .../allura/ext/admin/templates/widgets/block_list.html  |  2 +-
 Allura/allura/tests/functional/test_admin.py            |  3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9442d72b/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index d65f155..029da32 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -583,11 +583,6 @@ class DefaultAdminController(BaseController):
         permanent_redirect('permissions')
 
     @expose()
-    def edit_block_user(self, user_id='', perm=''):
-        del self.app.config.block_user[perm][user_id]
-        return redirect(request.referer)
-
-    @expose()
     def block_user(self, user_name, perm, reason=''):
         user = model.User.by_username(user_name)
         if not user:
@@ -600,6 +595,11 @@ class DefaultAdminController(BaseController):
             self.app.config.block_user[perm][str(user._id)] = reason
         return redirect(request.referer)
 
+    @expose()
+    def unblock_user(self, user_id='', perm=''):
+        del self.app.config.block_user[perm][user_id]
+        return redirect(request.referer)
+
     @expose('jinja:allura:templates/app_admin_permissions.html')
     @without_trailing_slash
     def permissions(self):
@@ -614,7 +614,7 @@ class DefaultAdminController(BaseController):
         block_list = {}
 
         for perm, users in self.app.config.block_user.items():
-            users_id = [ObjectId(id) for id in users.keys()]
+            users_id = [ObjectId(_id) for _id in users.keys()]
             block_list[perm] = dict()
             for user in model.User.query.find(dict(_id={'$in': users_id})):
                 block_list[perm][str(user._id)] = [user.username, users[str(user._id)]]

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9442d72b/Allura/allura/ext/admin/templates/widgets/block_list.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/widgets/block_list.html b/Allura/allura/ext/admin/templates/widgets/block_list.html
index f1584b1..9f3e7f3 100644
--- a/Allura/allura/ext/admin/templates/widgets/block_list.html
+++ b/Allura/allura/ext/admin/templates/widgets/block_list.html
@@ -1,5 +1,5 @@
 <h1>Block list</h1>
-<form action="edit_block_user">
+<form action="unblock_user">
 <div class="model-block-list"></div>
 <input type="hidden" class="block_user_role" name="perm" value="">
 <div class="grid-13">&nbsp;</div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9442d72b/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 3fb799c..24cf292 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -179,7 +179,6 @@ class TestProjectAdmin(TestController):
         assert_equals(app.config.block_user['read'], {str(user_id): 'Comment'})
         r = self.app.get('/admin/wiki/permissions')
         assert '<a href="#" class="block-list">' in r
-        r.showbrowser()
         assert '<input type="checkbox" name="user_id" value="%s">test-admin (Comment)'
% user_id in r
 
     @td.with_wiki
@@ -188,7 +187,7 @@ class TestProjectAdmin(TestController):
         app = M.Project.query.get(shortname='test').app_instance('wiki')
         user_id = M.User.by_username('test-admin')._id
         assert_equals(app.config.block_user['read'], {str(user_id): ''})
-        self.app.post('/admin/wiki/edit_block_user', params={'user_id': str(user_id), 'perm':
'read'})
+        self.app.post('/admin/wiki/unblock_user', params={'user_id': str(user_id), 'perm':
'read'})
         assert_equals(app.config.block_user['read'], dict())
         r = self.app.get('/admin/wiki/permissions')
         assert '<a href="#" class="block-list">' not in r


Mime
View raw message