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 """csv export views""" |
18 """csv export views""" |
19 |
19 |
20 __docformat__ = "restructuredtext en" |
20 __docformat__ = "restructuredtext en" |
21 _ = unicode |
21 _ = unicode |
|
22 |
|
23 from six.moves import range |
22 |
24 |
23 from cubicweb.schema import display_name |
25 from cubicweb.schema import display_name |
24 from cubicweb.predicates import any_rset, empty_rset |
26 from cubicweb.predicates import any_rset, empty_rset |
25 from cubicweb.uilib import UnicodeCSVWriter |
27 from cubicweb.uilib import UnicodeCSVWriter |
26 from cubicweb.view import EntityView, AnyRsetView |
28 from cubicweb.view import EntityView, AnyRsetView |
86 def call(self): |
88 def call(self): |
87 req = self._cw |
89 req = self._cw |
88 rows_by_type = {} |
90 rows_by_type = {} |
89 writer = self.csvwriter() |
91 writer = self.csvwriter() |
90 rowdef_by_type = {} |
92 rowdef_by_type = {} |
91 for index in xrange(len(self.cw_rset)): |
93 for index in range(len(self.cw_rset)): |
92 entity = self.cw_rset.complete_entity(index) |
94 entity = self.cw_rset.complete_entity(index) |
93 if entity.e_schema not in rows_by_type: |
95 if entity.e_schema not in rows_by_type: |
94 rowdef_by_type[entity.e_schema] = [rs for rs, at in entity.e_schema.attribute_definitions() |
96 rowdef_by_type[entity.e_schema] = [rs for rs, at in entity.e_schema.attribute_definitions() |
95 if at != 'Bytes'] |
97 if at != 'Bytes'] |
96 rows_by_type[entity.e_schema] = [[display_name(req, rschema.type) |
98 rows_by_type[entity.e_schema] = [[display_name(req, rschema.type) |