def handle_exception(requestHandler, exception, debug_mode): import cgi import sys import traceback import jsonpickle from feathers import utils if not debug_mode: trace = "".join(traceback.format_exception(*sys.exc_info())) try: trace = trace + "\n\n\nRequest state:\n" + jsonpickle.encode(requestHandler) except: trance = trace + "\n\n\nState request unavailable" # requestHandler.onRequest() requestHandler.CurrentTheme = None requestHandler.error(500) requestHandler.Model.update({"currentTheme": None, "trace": utils.text_to_linebreaks(trace)}) requestHandler.render2("views/http500.html") else: super(requestHandler, exception, debug_mode)
def text_with_linebreaks(self): from feathers import utils return utils.text_to_linebreaks(self.Text)
def text_last_words(self, wordsCutoff=1000): from feathers import utils return utils.text_to_linebreaks(utils.lastWords(self.Text, wordsCutoff))