move .view method on AppRsetObject, move initialize_varmaker method on View tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 26 Mar 2009 18:54:55 +0100
branchtls-sprint
changeset 1144 654047cd0c30
parent 1143 8d097defbf2c
child 1145 4162e5bb5367
move .view method on AppRsetObject, move initialize_varmaker method on View
appobject.py
view.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 ##################################################
     
--- 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'<div class="field">%s</div>' % value)
         if row:
             w(u'</div>')
+            
+    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 #################################################