示例#1
0
    def view(self,
             name: Optional[str] = None,
             model: Optional[Any] = None) -> Response:
        """
        Returns a view rendered synchronously.

        :param name: name of the template (path to the template file, optionally without '.html' extension
        :param model: optional model, required to render the template.
        :return: a Response object
        """
        if not name:
            name = self.get_default_view_name()

        if model:
            return view(self.templates, self.full_view_name(name), **model)
        return view(self.templates, self.full_view_name(name))
示例#2
0
 async def home(request):
     return view(request, 'home', **home_model)
示例#3
0
 async def home(jinja):
     return view(jinja, 'home', **home_model)
 async def home(jinja):
     return view(jinja, "home", home_model)