cwvreg.py
changeset 3655 af86ab65a282
parent 3451 6b46d73823f5
child 3674 387d51af966d
equal deleted inserted replaced
3654:e4bed64e0ad7 3655:af86ab65a282
   172 VRegistry.REGISTRY_FACTORY['etypes'] = ETypeRegistry
   172 VRegistry.REGISTRY_FACTORY['etypes'] = ETypeRegistry
   173 
   173 
   174 
   174 
   175 class ViewsRegistry(CWRegistry):
   175 class ViewsRegistry(CWRegistry):
   176 
   176 
   177     def main_template(self, req, oid='main-template', **kwargs):
   177     def main_template(self, req, oid='main-template', rset=None, **kwargs):
   178         """display query by calling the given template (default to main),
   178         """display query by calling the given template (default to main),
   179         and returning the output as a string instead of requiring the [w]rite
   179         and returning the output as a string instead of requiring the [w]rite
   180         method as argument
   180         method as argument
   181         """
   181         """
   182         res = self.render(oid, req, **kwargs)
   182         obj = self.select(oid, req, rset=rset, **kwargs)
       
   183         res = obj.render(**kwargs)
   183         if isinstance(res, unicode):
   184         if isinstance(res, unicode):
   184             return res.encode(req.encoding)
   185             return res.encode(req.encoding)
   185         assert isinstance(res, str)
   186         assert isinstance(res, str)
   186         return res
   187         return res
   187 
   188