[rest] avoid field on two lines if name is above some size limit. Closes #8961835
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 08 Dec 2015 10:24:44 +0100
changeset 10952 4f28cb25b6c1
parent 10792 daef7ce08fea
child 10953 8b8193046600
[rest] avoid field on two lines if name is above some size limit. Closes #8961835
ext/rest.py
ext/test/unittest_rest.py
--- a/ext/rest.py	Thu Jul 30 11:11:12 2015 +0200
+++ b/ext/rest.py	Tue Dec 08 10:24:44 2015 +0100
@@ -34,6 +34,7 @@
 """
 __docformat__ = "restructuredtext en"
 
+import sys
 from cStringIO import StringIO
 from itertools import chain
 from logging import getLogger
@@ -415,6 +416,8 @@
                 # (though try/except may be a better option...). May be the
                 # above traceback option will avoid this?
                 'halt_level': 10,
+                # disable stupid switch to colspan=2 if field name is above a size limit
+                'field_name_limit': sys.maxsize,
                 }
     if context:
         if hasattr(req, 'url'):
--- a/ext/test/unittest_rest.py	Thu Jul 30 11:11:12 2015 +0200
+++ b/ext/test/unittest_rest.py	Tue Dec 08 10:24:44 2015 +0100
@@ -58,6 +58,14 @@
 
 ''')
 
+    def test_disable_field_name_colspan(self):
+        with self.admin_access.web_request() as req:
+            context = self.context(req)
+            value = rest_publish(context, '''my field list:
+
+:a long dumb param name: value
+''')
+            self.assertNotIn('colspan', value)
 
     def test_rql_role_with_vid(self):
         with self.admin_access.web_request() as req: