def test_render_template_paths(self): os.chdir(BASE) self.assertEqual(['{"a": 1}'], robaccia.render({}, self._start_response, "list.json", {"a": 1})) robaccia.TEMPLATE_DIRS = [os.path.join("tests", "input", "templates")] self.assertEqual( ["<html><body><p>Hello World!</p></body></html>"], robaccia.render({}, self._start_response, "list.html", {"a": 1}, raw_etag="foo"), )
def test_render_template_paths(self): os.chdir(BASE) self.assertEqual(['{"a": 1}'], robaccia.render({}, self._start_response, 'list.json', {'a': 1})) robaccia.TEMPLATE_DIRS = [os.path.join("tests", "input", "templates")] self.assertEqual(['<html><body><p>Hello World!</p></body></html>'], robaccia.render({}, self._start_response, 'list.html', {'a': 1}, raw_etag="foo"))
def list(environ, start_response): rows = model.entry_table.select().execute() rows = [{"id": 1, "title": "title", "content": "content", "updated": "updated"}] print rows, '------------------------' return robaccia.render(start_response, 'list.html', locals())
def member_get(environ, start_response): id = environ['selector.vars'] row = model.entry_table.select(model.entry_table.c.id==id).execute().fetchone() return robaccia.render(start_response, 'entry.html', locals())
def list(environ, start_response): rows = model.entry_table.select().execute() return robaccia.render(start_response, 'list.html', locals())
def list(environ, start_response): rows = [row.title or " " for row in table.select(limit=5).execute()] if len(rows) < 5: rows.extend(["_"] * (5 - len(rows))) return robaccia.render(start_response, 'list.xhtml', locals())
def list(environ, start_response): print("Request to list the content in table.") rows = model.entry_table.select().execute() return robaccia.render(start_response, 'list.html', locals())