def GET(self, path=None, reply=None): if not path: path = conf.navigation.default_slug return PrettyRedirect('/' + path) (slug, ext) = splitext(path) ext = ext.lower() if not reply: reply = reply_form() if ext in PASSTHROUGH_EXTENSIONS: try: return open(join(conf.siteopts.root, path)).read() except IOError: return web.notfound() if os.path.isdir(join(conf.siteopts.root, slug)): return render.multiple_pages('Posts in ' + slug, get_gtf_in_slug(slug)) try: content = Content(slug) return render.single_page(content, reply) except IOError: raise web.notfound()
def GET(self, path=None, reply=None): if not path: path = conf.navigation.default_slug return PrettyRedirect('/'+path) (slug, ext) = splitext(path) ext = ext.lower() if not reply: reply = reply_form() if ext in PASSTHROUGH_EXTENSIONS: try: return open(join(conf.siteopts.root, path)).read() except IOError: return web.notfound() if os.path.isdir(join(conf.siteopts.root, slug)): return render.multiple_pages('Posts in '+slug, get_gtf_in_slug(slug)) try: content = Content(slug) return render.single_page(content, reply) except IOError: raise web.notfound()
def POST(self, path): reply = reply_form(web.input()) if not reply.validates(): return GTFO().GET(path, reply) else: comment = reply.d # no point in putting the capcha in the db del comment['capcha'] db.insert('comments', slug=path, **comment) return PrettyRedirect('/'+path)
def POST(self, path): reply = reply_form(web.input()) if not reply.validates(): return GTFO().GET(path, reply) else: comment = reply.d # no point in putting the capcha in the db del comment['capcha'] db.insert('comments', slug=path, **comment) return PrettyRedirect('/' + path)