| 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 | |
| 28 class BaseComponent(VNode): | 26 class BaseComponent(VNode): |
| 29 """base report component | 27 """base report component |
| 30 | 28 |
| 31 attributes | 29 attributes |
| 32 * id : the component's optional id | 30 * id : the component's optional id |
| 33 * klass : the component's optional klass | 31 * klass : the component's optional klass |
| 34 """ | 32 """ |
| 35 def __init__(self, id=None, klass=None): | 33 def __init__(self, id=None, klass=None): |
| 36 VNode.__init__(self, id) | 34 VNode.__init__(self, id) |
| 37 self.klass = klass | 35 self.klass = klass |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 """a text portion | 72 """a text portion |
| 75 | 73 |
| 76 attributes : | 74 attributes : |
| 77 * BaseComponent attributes | 75 * BaseComponent attributes |
| 78 * data : the text value as an encoded or unicode string | 76 * data : the text value as an encoded or unicode string |
| 79 """ | 77 """ |
| 80 def __init__(self, data, escaped=True, **kwargs): | 78 def __init__(self, data, escaped=True, **kwargs): |
| 81 super(Text, self).__init__(**kwargs) | 79 super(Text, self).__init__(**kwargs) |
| 82 #if isinstance(data, unicode): | 80 #if isinstance(data, unicode): |
| 83 # data = data.encode('ascii') | 81 # data = data.encode('ascii') |
| 84 assert isinstance(data, string_types), data.__class__ | 82 assert isinstance(data, (str, unicode)), data.__class__ |
| 85 self.escaped = escaped | 83 self.escaped = escaped |
| 86 self.data = data | 84 self.data = data |
| 87 | 85 |
| 88 class VerbatimText(Text): | 86 class VerbatimText(Text): |
| 89 """a verbatim text, display the raw data | 87 """a verbatim text, display the raw data |
| 90 | 88 |
| 91 attributes : | 89 attributes : |
| 92 * BaseComponent attributes | 90 * BaseComponent attributes |
| 93 * data : the text value as an encoded or unicode string | 91 * data : the text value as an encoded or unicode string |
| 94 """ | 92 """ |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 self.cheaders = cheaders | 192 self.cheaders = cheaders |
| 195 self.rrheaders = rrheaders | 193 self.rrheaders = rrheaders |
| 196 self.rcheaders = rcheaders | 194 self.rcheaders = rcheaders |
| 197 | 195 |
| 198 class List(BaseLayout): | 196 class List(BaseLayout): |
| 199 """some list data | 197 """some list data |
| 200 | 198 |
| 201 attributes : | 199 attributes : |
| 202 * BaseLayout attributes | 200 * BaseLayout attributes |
| 203 """ | 201 """ |
| OLD | NEW |