equal
deleted
inserted
replaced
126 from logilab.mtconverter import xml_escape |
126 from logilab.mtconverter import xml_escape |
127 from logilab.common.decorators import iclassmethod, cached |
127 from logilab.common.decorators import iclassmethod, cached |
128 from logilab.common.deprecation import deprecated |
128 from logilab.common.deprecation import deprecated |
129 |
129 |
130 from cubicweb import typed_eid, neg_role, uilib |
130 from cubicweb import typed_eid, neg_role, uilib |
|
131 from cubicweb.vregistry import classid |
131 from cubicweb.schema import display_name |
132 from cubicweb.schema import display_name |
132 from cubicweb.view import EntityView |
133 from cubicweb.view import EntityView |
133 from cubicweb.selectors import ( |
134 from cubicweb.selectors import ( |
134 match_kwargs, match_form_params, non_final_entity, |
135 match_kwargs, match_form_params, non_final_entity, |
135 specified_etype_implements) |
136 specified_etype_implements) |
305 @cached |
306 @cached |
306 def _entity(self): |
307 def _entity(self): |
307 try: |
308 try: |
308 cls = self._cw.vreg['etypes'].etype_class(self.etype) |
309 cls = self._cw.vreg['etypes'].etype_class(self.etype) |
309 except: |
310 except: |
310 self.w(self._cw._('no such entity type %s') % etype) |
311 self.w(self._cw._('no such entity type %s') % self.etype) |
311 return |
312 return |
312 entity = cls(self._cw) |
313 entity = cls(self._cw) |
313 entity.eid = self._cw.varmaker.next() |
314 entity.eid = self._cw.varmaker.next() |
314 return entity |
315 return entity |
315 |
316 |
731 |
732 |
732 def _generic_relations_field(self): |
733 def _generic_relations_field(self): |
733 try: |
734 try: |
734 srels_by_cat = self.srelations_by_category('generic', 'add', strict=True) |
735 srels_by_cat = self.srelations_by_category('generic', 'add', strict=True) |
735 warn('[3.6] %s: srelations_by_category is deprecated, use uicfg or ' |
736 warn('[3.6] %s: srelations_by_category is deprecated, use uicfg or ' |
736 'override editable_relations instead' % classid(form), |
737 'override editable_relations instead' % classid(self), |
737 DeprecationWarning) |
738 DeprecationWarning) |
738 except AttributeError: |
739 except AttributeError: |
739 srels_by_cat = self.editable_relations() |
740 srels_by_cat = self.editable_relations() |
740 if not srels_by_cat: |
741 if not srels_by_cat: |
741 raise f.FieldNotFound('_cw_generic_field') |
742 raise f.FieldNotFound('_cw_generic_field') |