allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [6/9] git commit: [#6456] Fixed validation of GC import form
Date Tue, 23 Jul 2013 02:52:49 GMT
[#6456] Fixed validation of GC import form

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/master
Commit: 5f68604dbc07864302a5c42ae9d71b8b25a52658
Parents: f70ea75
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Jul 22 22:53:25 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Jul 23 02:45:42 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/project.py             | 6 +++++-
 ForgeImporters/forgeimporters/google/templates/project.html | 4 +++-
 ForgeImporters/forgeimporters/tests/test_base.py            | 4 +++-
 3 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5f68604d/ForgeImporters/forgeimporters/google/project.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/project.py b/ForgeImporters/forgeimporters/google/project.py
index 678f16d..c3e4d17 100644
--- a/ForgeImporters/forgeimporters/google/project.py
+++ b/ForgeImporters/forgeimporters/google/project.py
@@ -34,7 +34,11 @@ from . import tasks
 
 class GoogleCodeProjectForm(schema.Schema):
     neighborhood = fev.PlainText(not_empty=True)
-    project_name = fev.Regex(r'^[a-z0-9][a-z0-9-]{,61}$', not_empty=True)
+    project_name = fev.Regex(r'^[a-z0-9][a-z0-9-]{,61}$',
+            not_empty=True,
+            messages={
+                'invalid': 'Please use only letters, numbers, and dashes.',
+            })
     project_shortname = NeighborhoodProjectShortNameValidator()
     tools = base.ToolsValidator('Google Code')
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5f68604d/ForgeImporters/forgeimporters/google/templates/project.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/templates/project.html b/ForgeImporters/forgeimporters/google/templates/project.html
index 614e1cb..2cda0d0 100644
--- a/ForgeImporters/forgeimporters/google/templates/project.html
+++ b/ForgeImporters/forgeimporters/google/templates/project.html
@@ -40,9 +40,11 @@
 
         var manual = false;
         function suggest_name() {
+            var $project_shortname = $('#project_shortname');
             if (!manual) {
-                $('#project_shortname').val($('#project_name').val()).trigger('change');
+                $project_shortname.val($('#project_name').val());
             }
+            $project_shortname.trigger('change');
         }
 
         function check_names() {

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5f68604d/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index 64096fd..303570d 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -39,9 +39,11 @@ class TestProjectImporterDispatcher(TestCase):
     @mock.patch.object(base, 'iter_entry_points')
     def test_lookup(self, iep):
         eps = iep.return_value = [ep('ep1', 'first'), ep('ep2', 'second')]
-        result = base.ProjectImporterDispatcher()._lookup('source', 'rest1', 'rest2')
+        nbhd = mock.Mock(name='neighborhood')
+        result = base.ProjectImporterDispatcher(nbhd)._lookup('source', 'rest1', 'rest2')
         self.assertEqual(result, (eps[0].lv, ('rest1', 'rest2')))
         iep.assert_called_once_with('allura.project_importers', 'source')
+        eps[0].load.return_value.assert_called_once_with(nbhd)
 
 
 class TestProjectImporter(TestCase):


Mime
View raw message