OLD | NEW |
1 # copyright 2003-2011 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 logilab-common. | 4 # This file is part of logilab-common. |
5 # | 5 # |
6 # logilab-common is free software: you can redistribute it and/or modify it unde
r | 6 # logilab-common is free software: you can redistribute it and/or modify it unde
r |
7 # the terms of the GNU Lesser General Public License as published by the Free | 7 # the terms of the GNU Lesser General Public License as published by the Free |
8 # Software Foundation, either version 2.1 of the License, or (at your option) an
y | 8 # Software Foundation, either version 2.1 of the License, or (at your option) an
y |
9 # later version. | 9 # later version. |
10 # | 10 # |
11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT | 11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT |
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
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 logilab-common. If not, see <http://www.gnu.org/licenses/>. | 17 # with logilab-common. If not, see <http://www.gnu.org/licenses/>. |
18 """Micro reports objects. | 18 """Micro reports objects. |
19 | 19 |
20 A micro report is a tree of layout and content objects. | 20 A micro report is a tree of layout and content objects. |
21 """ | 21 """ |
22 __docformat__ = "restructuredtext en" | 22 __docformat__ = "restructuredtext en" |
23 | 23 |
24 from logilab.common.tree import VNode | 24 from logilab.common.tree import VNode |
25 | 25 |
| 26 from six import string_types |
| 27 |
26 class BaseComponent(VNode): | 28 class BaseComponent(VNode): |
27 """base report component | 29 """base report component |
28 | 30 |
29 attributes | 31 attributes |
30 * id : the component's optional id | 32 * id : the component's optional id |
31 * klass : the component's optional klass | 33 * klass : the component's optional klass |
32 """ | 34 """ |
33 def __init__(self, id=None, klass=None): | 35 def __init__(self, id=None, klass=None): |
34 VNode.__init__(self, id) | 36 VNode.__init__(self, id) |
35 self.klass = klass | 37 self.klass = klass |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 """a text portion | 74 """a text portion |
73 | 75 |
74 attributes : | 76 attributes : |
75 * BaseComponent attributes | 77 * BaseComponent attributes |
76 * data : the text value as an encoded or unicode string | 78 * data : the text value as an encoded or unicode string |
77 """ | 79 """ |
78 def __init__(self, data, escaped=True, **kwargs): | 80 def __init__(self, data, escaped=True, **kwargs): |
79 super(Text, self).__init__(**kwargs) | 81 super(Text, self).__init__(**kwargs) |
80 #if isinstance(data, unicode): | 82 #if isinstance(data, unicode): |
81 # data = data.encode('ascii') | 83 # data = data.encode('ascii') |
82 assert isinstance(data, (str, unicode)), data.__class__ | 84 assert isinstance(data, string_types), data.__class__ |
83 self.escaped = escaped | 85 self.escaped = escaped |
84 self.data = data | 86 self.data = data |
85 | 87 |
86 class VerbatimText(Text): | 88 class VerbatimText(Text): |
87 """a verbatim text, display the raw data | 89 """a verbatim text, display the raw data |
88 | 90 |
89 attributes : | 91 attributes : |
90 * BaseComponent attributes | 92 * BaseComponent attributes |
91 * data : the text value as an encoded or unicode string | 93 * data : the text value as an encoded or unicode string |
92 """ | 94 """ |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 self.cheaders = cheaders | 194 self.cheaders = cheaders |
193 self.rrheaders = rrheaders | 195 self.rrheaders = rrheaders |
194 self.rcheaders = rcheaders | 196 self.rcheaders = rcheaders |
195 | 197 |
196 class List(BaseLayout): | 198 class List(BaseLayout): |
197 """some list data | 199 """some list data |
198 | 200 |
199 attributes : | 201 attributes : |
200 * BaseLayout attributes | 202 * BaseLayout attributes |
201 """ | 203 """ |
OLD | NEW |