[view] fix TypeError when calling req.view('vid', entity=entity) (closes #1947474)
--- a/view.py Thu Sep 22 17:20:38 2011 +0200
+++ b/view.py Thu Sep 22 17:20:41 2011 +0200
@@ -375,7 +375,19 @@
def call(self, **kwargs):
if self.cw_rset is None:
- self.entity_call(self.cw_extra_kwargs.pop('entity'))
+ # * cw_extra_kwargs is the place where extra selection arguments are
+ # stored
+ # * when calling req.view('somevid', entity=entity), 'entity' ends
+ # up in cw_extra_kwargs and kwargs
+ #
+ # handle that to avoid a TypeError with a sanity check
+ #
+ # Notice that could probably be avoided by handling entity_call in
+ # .render
+ entity = self.cw_extra_kwargs.pop('entity')
+ if 'entity' in kwargs:
+ assert kwargs.pop('entity') is entity
+ self.entity_call(entity, **kwargs)
else:
super(EntityView, self).call(**kwargs)