Skip to content

Instantly share code, notes, and snippets.

@adeel
Created January 23, 2009 05:35
Show Gist options
  • Save adeel/50905 to your computer and use it in GitHub Desktop.
Save adeel/50905 to your computer and use it in GitHub Desktop.
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