# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1238090095 -3600 # Node ID 654047cd0c30171c28d65923f2a32cf6c33f26d6 # Parent 8d097defbf2c7ff21c32fb777a7a187e8eb798bb move .view method on AppRsetObject, move initialize_varmaker method on View diff -r 8d097defbf2c -r 654047cd0c30 appobject.py --- a/appobject.py Thu Mar 26 18:54:26 2009 +0100 +++ b/appobject.py Thu Mar 26 18:54:55 2009 +0100 @@ -183,6 +183,16 @@ rql = rqlst.as_string(kwargs=self.rset.args) rqlst.parent = None return rql + + def view(self, __vid, rset=None, __fallback_vid=None, **kwargs): + """shortcut to self.vreg.render method avoiding to pass self.req""" + try: + view = self.vreg.select_view(__vid, self.req, rset, **kwargs) + except NoSelectableObject: + if __fallback_vid is None: + raise + view = self.vreg.select_view(__fallback_vid, self.req, rset, **kwargs) + return view.dispatch(**kwargs) # url generation methods ################################################## diff -r 8d097defbf2c -r 654047cd0c30 view.py --- a/view.py Thu Mar 26 18:54:26 2009 +0100 +++ b/view.py Thu Mar 26 18:54:55 2009 +0100 @@ -206,16 +206,6 @@ self.req.set_content_type(self.content_type) # view utilities ########################################################## - - def view(self, __vid, rset=None, __fallback_vid=None, **kwargs): - """shortcut to self.vreg.render method avoiding to pass self.req""" - try: - view = self.vreg.select_view(__vid, self.req, rset, **kwargs) - except NoSelectableObject: - if __fallback_vid is None: - raise - view = self.vreg.select_view(__fallback_vid, self.req, rset, **kwargs) - return view.dispatch(**kwargs) def wview(self, __vid, rset, __fallback_vid=None, **kwargs): """shortcut to self.view method automatically passing self.w as argument @@ -317,6 +307,14 @@ w(u'
%s
' % value) if row: w(u'') + + def initialize_varmaker(self): + varmaker = self.req.get_page_data('rql_varmaker') + if varmaker is None: + varmaker = self.req.varmaker + self.req.set_page_data('rql_varmaker', varmaker) + self.varmaker = varmaker + # concrete views base classes #################################################