366 self.e_schema.check_perm(self.req, action, self.eid) |
366 self.e_schema.check_perm(self.req, action, self.eid) |
367 |
367 |
368 def has_perm(self, action): |
368 def has_perm(self, action): |
369 return self.e_schema.has_perm(self.req, action, self.eid) |
369 return self.e_schema.has_perm(self.req, action, self.eid) |
370 |
370 |
371 def view(self, vid, __registry='views', **kwargs): |
371 def view(self, vid, **kwargs): |
372 """shortcut to apply a view on this entity""" |
372 """shortcut to apply a view on this entity""" |
373 return self.vreg.render(__registry, vid, self.req, rset=self.rset, |
373 return self.vreg.render(vid, self.req, rset=self.rset, |
374 row=self.row, col=self.col, **kwargs) |
374 row=self.row, col=self.col, **kwargs) |
375 |
375 |
376 def absolute_url(self, method=None, **kwargs): |
376 def absolute_url(self, method=None, **kwargs): |
377 """return an absolute url to view this entity""" |
377 """return an absolute url to view this entity""" |
378 # in linksearch mode, we don't want external urls else selecting |
378 # in linksearch mode, we don't want external urls else selecting |
723 |
723 |
724 If `eid` is None in one of these couples, it should be |
724 If `eid` is None in one of these couples, it should be |
725 interpreted as a separator in case vocabulary results are grouped |
725 interpreted as a separator in case vocabulary results are grouped |
726 """ |
726 """ |
727 from logilab.common.testlib import mock_object |
727 from logilab.common.testlib import mock_object |
728 form = self.vreg.select_object('forms', 'edition', self.req, entity=self) |
728 form = self.vreg.select('forms', 'edition', self.req, entity=self) |
729 field = mock_object(name=rtype, role=role) |
729 field = mock_object(name=rtype, role=role) |
730 return form.form_field_vocabulary(field, limit) |
730 return form.form_field_vocabulary(field, limit) |
731 |
731 |
732 def unrelated_rql(self, rtype, targettype, role, ordermethod=None, |
732 def unrelated_rql(self, rtype, targettype, role, ordermethod=None, |
733 vocabconstraints=True): |
733 vocabconstraints=True): |