incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [15/50] [abbrv] git commit: [#5658] Fix redirect and path validation
Date Mon, 25 Feb 2013 21:56:17 GMT
[#5658] Fix redirect and path validation


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

Branch: refs/heads/si/5453
Commit: cc78b920e3e8e1652e385f7584b6dd827a4e9e1b
Parents: 550d4f9
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Thu Feb 21 16:05:10 2013 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Thu Feb 21 16:32:23 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/site_admin.py |    2 +-
 Allura/allura/lib/validators.py         |    2 +-
 Allura/allura/tests/test_validators.py  |    5 ++++-
 3 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cc78b920/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 7bb2c5d..096aba7 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -328,7 +328,7 @@ class TaskManagerController(object):
             config_dict['user'] = user
         with h.push_config(c, **config_dict):
             task = task.post(*args, **kw)
-        redirect('view', task_id=task._id)
+        redirect('view/%s' % task._id)
 
     @expose('json:')
     def task_doc(self, task_name):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cc78b920/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index de6bf51..5c4c54e 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -138,7 +138,7 @@ class CreateTaskSchema(fe.Schema):
     task = TaskValidator(not_empty=True, strip=True)
     task_args = JsonConverter(if_missing=dict(args=[], kwargs={}))
     user = UserValidator(strip=True, if_missing=None)
-    path = PathValidator(strip=True, if_missing={})
+    path = PathValidator(strip=True, if_missing={}, if_empty={})
 
 class DateValidator(fev.FancyValidator):
     def _to_python(self, value, state):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/cc78b920/Allura/allura/tests/test_validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_validators.py b/Allura/allura/tests/test_validators.py
index 5472e2d..95f48ef 100644
--- a/Allura/allura/tests/test_validators.py
+++ b/Allura/allura/tests/test_validators.py
@@ -67,7 +67,7 @@ class TestTaskValidator(unittest.TestCase):
 
 
 class TestPathValidator(unittest.TestCase):
-    val = v.PathValidator
+    val = v.PathValidator(strip=True, if_missing={}, if_empty={})
 
     def test_valid_project(self):
         project = M.Project.query.get(shortname='test')
@@ -102,3 +102,6 @@ class TestPathValidator(unittest.TestCase):
         with self.assertRaises(fe.Invalid) as cm:
             self.val.to_python('/p/test/badapp')
         self.assertEqual(str(cm.exception), 'Invalid app mount point: badapp')
+
+    def test_no_input(self):
+        self.assertEqual({}, self.val.to_python(''))


Mime
View raw message