[entity] entity.view now support initargs as req.view stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 10 Aug 2010 14:20:21 +0200
branchstable
changeset 6085 8a059eefac75
parent 6084 c764be84700d
child 6086 2b53a8669c98
[entity] entity.view now support initargs as req.view
entity.py
--- a/entity.py	Tue Aug 10 14:19:55 2010 +0200
+++ b/entity.py	Tue Aug 10 14:20:21 2010 +0200
@@ -456,11 +456,15 @@
     def cw_has_perm(self, action):
         return self.e_schema.has_perm(self._cw, action, eid=self.eid)
 
-    def view(self, __vid, __registry='views', w=None, **kwargs): # XXX cw_view
+    def view(self, __vid, __registry='views', w=None, initargs=None, **kwargs): # XXX cw_view
         """shortcut to apply a view on this entity"""
+        if initargs is None:
+            initargs = kwargs
+        else:
+            initargs.update(kwargs)
         view = self._cw.vreg[__registry].select(__vid, self._cw, rset=self.cw_rset,
                                                 row=self.cw_row, col=self.cw_col,
-                                                **kwargs)
+                                                **initargs)
         return view.render(row=self.cw_row, col=self.cw_col, w=w, **kwargs)
 
     def absolute_url(self, *args, **kwargs): # XXX cw_url