incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/2] git commit: [#6149] ticket:341 use shlex for select custom field
Date Wed, 15 May 2013 21:47:09 GMT
[#6149]  ticket:341 use shlex for select custom field


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

Branch: refs/heads/master
Commit: 6b9681782047a89518ea36b3b17e6f551d779130
Parents: 9834182
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Sun May 12 18:11:40 2013 +0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Wed May 15 21:46:50 2013 +0000

----------------------------------------------------------------------
 .../forgetracker/tests/functional/test_root.py     |   18 +++++++++++++++
 ForgeTracker/forgetracker/widgets/ticket_form.py   |    3 +-
 2 files changed, 20 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6b968178/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index dfaaba1..b80e28b 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -627,6 +627,24 @@ class TestFunctionalController(TrackerTestController):
         assert 'normal' in ticket_view
         assert 'Test Admin' in ticket_view
 
+    def test_select_custom_field(self):
+        params = dict(
+            custom_fields=[
+                dict(name='_testselect', label='Test', type='select',
+                     options='"test select"'),
+               ],
+            open_status_names='aa bb',
+            closed_status_names='cc',
+            )
+        self.app.post(
+            '/admin/bugs/set_custom_fields',
+            params=variable_encode(params))
+        r = self.app.get('/bugs/new/')
+        assert '<option value="test select">test select</option>' in r
+        kw = {'custom_fields._testselect':'test select'}
+        ticket_view = self.new_ticket(summary='test select custom fields', **kw).follow()
+        assert '<option selected value="test select">test select</option>' in
ticket_view
+
     def test_custom_field_update_comments(self):
         params = dict(
             custom_fields=[

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/6b968178/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 0cd13e5..f253484 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -16,6 +16,7 @@
 #       under the License.
 
 from allura.lib.widgets import form_fields as ffw
+import shlex
 
 from pylons import tmpl_context as c
 from formencode import validators as fev
@@ -149,7 +150,7 @@ class TicketCustomField(object):
 
     def _select(field):
         options = []
-        for opt in field.options.split():
+        for opt in shlex.split(field.options):
             selected = False
             if opt.startswith('*'):
                 opt = opt[1:]


Mime
View raw message