예제 #1
0
파일: main.py 프로젝트: motord/coconut
def get_content(path):
    if path=='':
        path='index.html'
#    memcache.delete(path)
    content=memcache.get(path)
    if content is None:
        content=StaticContent.get_by_key_name(path)
        if path=='index.html':
            centipedes=Centipede.gql("ORDER BY modified DESC LIMIT 25")
            content=StaticContent(key_name=path, body=db.Text(template('index.html', centipedes=centipedes)).encode('utf8'), content_type='text/html')
            content.put()
        else:
            if content is None:
                return HTTPError(404, "Page not found")
            else:
                if content.template:
                    content.template=db.Text(template(content.template, template_next=False, stanzas=[]))
                    content.body= content.template.encode('utf8')

#        memcache.set(path, content, 10800)

    return _output(content)