def render_email_template(self, **kwargs): if not self.template_location: raise RendereringException('missing template_location') if not self.template_location.startswith('emails/'): self.template_location = 'emails/' + self.template_location template_vars = {} template_vars.update(kwargs) return renderer.render(self.template_location, **template_vars)
def render(template_name, request, status_code=None, **template_vars): template_vars["request"] = request template_vars["session"] = session template_vars["config"] = current_app.config current_app.update_template_context(template_vars) body = renderer.render(template_name, **template_vars) if status_code is None: if request.method == "POST": status_code = 201 elif request.method == "DELETE": status_code = 204 else: status_code = 200 return Response(body, status=status_code)
def render(template_name, request, status_code=None, **template_vars): template_vars['request'] = request template_vars['session'] = session template_vars['config'] = current_app.config current_app.update_template_context(template_vars) body = renderer.render(template_name, **template_vars) if status_code is None: if request.method == 'POST': status_code = 201 elif request.method == 'DELETE': status_code = 204 else: status_code = 200 return Response(body, status=status_code)