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 |
20 |
21 from cubicweb import _ |
21 from cubicweb import _ |
22 |
|
23 from six import string_types |
|
24 |
22 |
25 from logilab.common.ureports import Section, Title, Table, Link, Span, Text |
23 from logilab.common.ureports import Section, Title, Table, Link, Span, Text |
26 |
24 |
27 from yams.schema2dot import CARD_MAP |
25 from yams.schema2dot import CARD_MAP |
28 from yams.schema import RelationDefinitionSchema |
26 from yams.schema import RelationDefinitionSchema |
226 val = str(val) |
224 val = str(val) |
227 |
225 |
228 elif isinstance(val, (list, tuple)): |
226 elif isinstance(val, (list, tuple)): |
229 val = sorted(val) |
227 val = sorted(val) |
230 val = ', '.join(str(v) for v in val) |
228 val = ', '.join(str(v) for v in val) |
231 elif val and isinstance(val, string_types): |
229 elif val and isinstance(val, str): |
232 val = _(val) |
230 val = _(val) |
233 else: |
231 else: |
234 val = str(val) |
232 val = str(val) |
235 data.append(Text(val)) |
233 data.append(Text(val)) |
236 table = Table(cols=cols, rheaders=1, children=data, klass='listing') |
234 table = Table(cols=cols, rheaders=1, children=data, klass='listing') |