equal
deleted
inserted
replaced
1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # |
3 # |
4 # This file is part of CubicWeb. |
4 # This file is part of CubicWeb. |
5 # |
5 # |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
14 # details. |
14 # details. |
15 # |
15 # |
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
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 """ |
|
21 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
22 _ = unicode |
21 _ = unicode |
23 |
22 |
24 from logilab.common.ureports import Section, Title, Table, Link, Span, Text |
23 from logilab.common.ureports import Section, Title, Table, Link, Span, Text |
25 |
24 |
215 for prop in properties: |
214 for prop in properties: |
216 val = getattr(rdef, prop) |
215 val = getattr(rdef, prop) |
217 if val is None: |
216 if val is None: |
218 val = '' |
217 val = '' |
219 elif prop == 'constraints': |
218 elif prop == 'constraints': |
220 val = ', '.join([c.restriction for c in val]) |
219 val = ', '.join([c.expression for c in val]) |
221 elif isinstance(val, dict): |
220 elif isinstance(val, dict): |
222 for key, value in val.iteritems(): |
221 for key, value in val.iteritems(): |
223 if isinstance(value, (list, tuple)): |
222 if isinstance(value, (list, tuple)): |
224 val[key] = ', '.join(sorted( str(v) for v in value)) |
223 val[key] = ', '.join(sorted( str(v) for v in value)) |
225 val = str(val) |
224 val = str(val) |