equal
deleted
inserted
replaced
23 from itertools import cycle |
23 from itertools import cycle |
24 |
24 |
25 import tempfile |
25 import tempfile |
26 import os, os.path as osp |
26 import os, os.path as osp |
27 import codecs |
27 import codecs |
28 |
|
29 from six import text_type |
|
30 |
28 |
31 from logilab.common.graph import GraphGenerator, DotBackend |
29 from logilab.common.graph import GraphGenerator, DotBackend |
32 from logilab.common.ureports import Section, Table |
30 from logilab.common.ureports import Section, Table |
33 from logilab.common.registry import yes |
31 from logilab.common.registry import yes |
34 from logilab.mtconverter import xml_escape |
32 from logilab.mtconverter import xml_escape |
279 __regid__ = 'etype-attr-defaultval-cell' |
277 __regid__ = 'etype-attr-defaultval-cell' |
280 |
278 |
281 def cell_call(self, row, col): |
279 def cell_call(self, row, col): |
282 defaultval = self.cw_rset.rows[row][col] |
280 defaultval = self.cw_rset.rows[row][col] |
283 if defaultval is not None: |
281 if defaultval is not None: |
284 self.w(text_type(self.cw_rset.rows[row][col].unzpickle())) |
282 self.w(str(self.cw_rset.rows[row][col].unzpickle())) |
285 |
283 |
286 class CWETypeRelationCardinalityCell(baseviews.FinalView): |
284 class CWETypeRelationCardinalityCell(baseviews.FinalView): |
287 __regid__ = 'etype-rel-cardinality-cell' |
285 __regid__ = 'etype-rel-cardinality-cell' |
288 |
286 |
289 def cell_call(self, row, col): |
287 def cell_call(self, row, col): |
487 |
485 |
488 def cell_call(self, row, col): |
486 def cell_call(self, row, col): |
489 entity = self.cw_rset.get_entity(row, col) |
487 entity = self.cw_rset.get_entity(row, col) |
490 rschema = self._cw.vreg.schema.rschema(entity.rtype.name) |
488 rschema = self._cw.vreg.schema.rschema(entity.rtype.name) |
491 rdef = rschema.rdefs[(entity.stype.name, entity.otype.name)] |
489 rdef = rschema.rdefs[(entity.stype.name, entity.otype.name)] |
492 constraints = [xml_escape(text_type(c)) for c in getattr(rdef, 'constraints')] |
490 constraints = [xml_escape(str(c)) for c in getattr(rdef, 'constraints')] |
493 self.w(u'<br/>'.join(constraints)) |
491 self.w(u'<br/>'.join(constraints)) |
494 |
492 |
495 class CWAttributeOptionsCell(EntityView): |
493 class CWAttributeOptionsCell(EntityView): |
496 __regid__ = 'rdef-options-cell' |
494 __regid__ = 'rdef-options-cell' |
497 __select__ = is_instance('CWAttribute') |
495 __select__ = is_instance('CWAttribute') |