def tojson(self, autoescape = True): t = handle() try: s = force_str(self.dumps()) return s if not autoescape else t.mark_safe(s) except Exception as e: return self.handleError(e, autoescape)
def render(self, template_engine = None): loader = template.handle(template_engine) if self.process: data = self.clone(self.process(self.data)) else: data = self return loader.render(self.template,data)
def loader(self): from djpcms.template import handle return handle("jinja2")
def __init__(self, err, url = None): loader = handle() self.html = loader.render_to_string(['bits/post-error.html', 'djpcms/bits/post-error.html'], {'error':loader.mark_safe(err), 'url': url})
def handleError(self, e, autoescape = True): t = handle() s = force_str(e) return s if not autoescape else t.mark_safe(s)