454 self.e_schema.check_perm(self._cw, action, eid=self.eid) |
454 self.e_schema.check_perm(self._cw, action, eid=self.eid) |
455 |
455 |
456 def cw_has_perm(self, action): |
456 def cw_has_perm(self, action): |
457 return self.e_schema.has_perm(self._cw, action, eid=self.eid) |
457 return self.e_schema.has_perm(self._cw, action, eid=self.eid) |
458 |
458 |
459 def view(self, __vid, __registry='views', w=None, **kwargs): # XXX cw_view |
459 def view(self, __vid, __registry='views', w=None, initargs=None, **kwargs): # XXX cw_view |
460 """shortcut to apply a view on this entity""" |
460 """shortcut to apply a view on this entity""" |
|
461 if initargs is None: |
|
462 initargs = kwargs |
|
463 else: |
|
464 initargs.update(kwargs) |
461 view = self._cw.vreg[__registry].select(__vid, self._cw, rset=self.cw_rset, |
465 view = self._cw.vreg[__registry].select(__vid, self._cw, rset=self.cw_rset, |
462 row=self.cw_row, col=self.cw_col, |
466 row=self.cw_row, col=self.cw_col, |
463 **kwargs) |
467 **initargs) |
464 return view.render(row=self.cw_row, col=self.cw_col, w=w, **kwargs) |
468 return view.render(row=self.cw_row, col=self.cw_col, w=w, **kwargs) |
465 |
469 |
466 def absolute_url(self, *args, **kwargs): # XXX cw_url |
470 def absolute_url(self, *args, **kwargs): # XXX cw_url |
467 """return an absolute url to view this entity""" |
471 """return an absolute url to view this entity""" |
468 # use *args since we don't want first argument to be "anonymous" to |
472 # use *args since we don't want first argument to be "anonymous" to |