import creoleparser import genshi import datetime from settings import DATE_FORMAT_SHORT, DATE_FORMAT_FULL def formatter(text): if not text: return u"" text = text.replace("\\", "\\\\") html = creoleparser.text2html(text, encoding=None).strip() if html.startswith("
") and html.endswith("
"): html = html[3:-4] return genshi.Markup(html) last_day = datetime.datetime.today() - datetime.timedelta(days=1) def show_timestamp(date): if date <= last_day: template = DATE_FORMAT_SHORT else: template = DATE_FORMAT_FULL return date.strftime(template) def nav_links(prev_link, next_link): result = [] if prev_link: result.append('aktuellere' % prev_link) if next_link: result.append('ältere' % next_link) return genshi.Markup(" | ".join(result))