def test_list_extend(): b = [] e = b.extend table = ctx['table'] e(('<table>\n', )) for row in table: e(('<tr>\n', )) for key, value in row.items(): e(('<td>', escape(key), '</td><td>', str(value), '</td>\n')) e(('</tr>\n', )) e(('</table>', )) return ''.join(b)
def root() -> typing.Iterator[str]: table = ctx["table"] yield "<table>\n" for row in table: yield " <tr>\n" for key, value in row.items(): yield " <td>" yield escape(key) yield "</td><td>" yield s(value) yield "</td>\n" yield " </tr>\n" yield "</table>"
def test_list_append(): # noqa b = [] w = b.append table = ctx['table'] w(u'<table>\n') for row in table: w(u'<tr>\n') for key, value in row.items(): w(u'<td>') w(escape(key)) w(u'</td><td>') w(unicode(value)) w(u'</td>\n') w(u'</tr>\n') w(u'</table>') return ''.join(b)
def test_list_extend(): # noqa b = [] e = b.extend table = ctx['table'] e((u'<table>\n',)) for row in table: e((u'<tr>\n',)) for key, value in row.items(): e((u'<td>', escape(key), u'</td><td>', unicode(value), u'</td>\n')) e((u'</tr>\n',)) e((u'</table>',)) return ''.join(b)
def test_list_extend(): # noqa b = [] e = b.extend table = ctx['table'] e((u'<table>\n', )) for row in table: e((u'<tr>\n', )) for key, value in row.items(): e((u'<td>', )) e((escape(key), )) e((u'</td><td>', )) e((unicode(value), )) e((u'</td>\n', )) e((u'</tr>\n', )) e((u'</table>', )) return ''.join(b)
def test_list_append() -> str: b: typing.List[str] = [] w = b.append table = ctx["table"] w("<table>\n") for row in table: w(" <tr>\n") for key, value in row.items(): w(" <td>") w(escape(key)) w("</td><td>") w(str(value)) w("</td>\n") w(" </tr>\n") w("</table>") return "".join(b)
def test_list_extend() -> str: b: typing.List[str] = [] e = b.extend table = ctx["table"] e(("<table>\n", )) for row in table: e((" <tr>\n", )) for key, value in row.items(): e(( " <td>", escape(key), "</td><td>", s(value), "</td>\n", )) e((" </tr>\n", )) e(("</table>", )) return "".join(b)
try: from wheezy.html.utils import escape_html as escape except ImportError: import cgi escape = cgi.escape import json def formatTime(t): tm = time.localtime(t) if tm.tm_min == 0 and tm.tm_hour == 0: return time.strftime("%d.%m.%Y",tm) else: return time.strftime("%d.%m.%Y %H:%M", tm) engine.global_vars.update({ 'h': lambda x: escape(str(x)), 'j': json.dumps, 't': formatTime, 'f': lambda x: str(float(x)), 'i': lambda x: str(int(x)), }) class Entry(object): def __init__(self, **params): self.__dict__.update(params) def createHTMLTools(): return "" class AjaxManager(object): __metaclass__ = ManagedMeta