equal
deleted
inserted
replaced
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 """an helper class to display CubicWeb schema using ureports""" |
18 """an helper class to display CubicWeb schema using ureports""" |
19 |
19 |
20 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
21 _ = unicode |
21 _ = unicode |
|
22 |
|
23 from six import string_types |
22 |
24 |
23 from logilab.common.ureports import Section, Title, Table, Link, Span, Text |
25 from logilab.common.ureports import Section, Title, Table, Link, Span, Text |
24 |
26 |
25 from yams.schema2dot import CARD_MAP |
27 from yams.schema2dot import CARD_MAP |
26 from yams.schema import RelationDefinitionSchema |
28 from yams.schema import RelationDefinitionSchema |
224 val = str(val) |
226 val = str(val) |
225 |
227 |
226 elif isinstance(val, (list, tuple)): |
228 elif isinstance(val, (list, tuple)): |
227 val = sorted(val) |
229 val = sorted(val) |
228 val = ', '.join(str(v) for v in val) |
230 val = ', '.join(str(v) for v in val) |
229 elif val and isinstance(val, basestring): |
231 elif val and isinstance(val, string_types): |
230 val = _(val) |
232 val = _(val) |
231 else: |
233 else: |
232 val = str(val) |
234 val = str(val) |
233 data.append(Text(val)) |
235 data.append(Text(val)) |
234 table = Table(cols=cols, rheaders=1, children=data, klass='listing') |
236 table = Table(cols=cols, rheaders=1, children=data, klass='listing') |