Example #1
0
 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"),
     )
Example #2
0
 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"))
Example #3
0
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())
Example #4
0
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())
Example #5
0
def list(environ, start_response):
    rows = model.entry_table.select().execute()
    return robaccia.render(start_response, 'list.html', locals())
Example #6
0
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())
Example #7
0
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())
Example #8
0
def list(environ, start_response):
    rows = model.entry_table.select().execute()
    return robaccia.render(start_response, 'list.html', locals())