Ejemplo n.º 1
0
def scroll(page):
    path = str(page) + ".html"
    content = memcache.get(path)
    if content is None:
        content = StaticContent.get_by_key_name(path)
        if content is None:
            bottles = Bottled.gql("ORDER BY created DESC LIMIT 25 OFFSET " + str(page * 25 - 24))
            content = StaticContent(
                key_name=path, body=str(template("page.html", bottles=bottles)), content_type="text/html"
            )
            content.put()
        memcache.set(path, content, 43200)

    return _output(content)
Ejemplo n.º 2
0
def get_content(path):
    if path == "":
        path = "index.html"
    content = memcache.get(path)
    if content is None:
        content = StaticContent.get_by_key_name(path)
        if content is None:
            if path == "index.html":
                bottles = Bottled.gql("ORDER BY created DESC LIMIT 25")
                content = StaticContent(
                    key_name=path, body=str(template("index.html", bottles=bottles)), content_type="text/html"
                )
                content.put()
            else:
                return
        memcache.set(path, content, 43200)

    return _output(content)