Created
January 23, 2009 05:35
-
-
Save adeel/50905 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import berry | |
from berry import path, render, redirect | |
from models import Post | |
def index(): | |
posts = Post.query.all() | |
return render('index', {'posts': posts}) | |
path('^$').GET = index | |
def post(id): | |
post = Post.get_by(id=id) | |
if not post: | |
redirect('/') | |
return render('post', {'post': post}) | |
path('^(\d+)/?$').GET = post | |
berry.start() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment