appobject.py
branchtls-sprint
changeset 1144 654047cd0c30
parent 1143 8d097defbf2c
child 1174 7dac5aeafb86
--- 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 ##################################################