# HG changeset patch # User Sylvain Thénault # Date 1316704841 -7200 # Node ID f19e3203dff6b454f9685c10d4346d8e9c2ae90a # Parent 953f224357af83cfc5b4d8df8bca9752158aa13e [view] fix TypeError when calling req.view('vid', entity=entity) (closes #1947474) diff -r 953f224357af -r f19e3203dff6 view.py --- 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)