bustleandflurry/bottle-api-json-formatting — pull request #4 by edersohe (2013-10-08 03:36:55+00:00)
Title: support for dumps bson objects

from bottle import Bottle, run
from bottle_api_json_formatting import JsonFormatting
from pymongo import MongoClient

app = Bottle()
app.install(JsonFormatting())

db = MongoClient().test_database

db.users.insert({'username': 'user1', 'first_name': 'User', 'last_name': 'One' })
db.users.insert({'username': 'user2', 'first_name': 'User', 'last_name': 'Two' })

@app.get('/users')
def index():
return db.users.find()

if __name__ == '__main__':
run(app, host='0.0.0.0', port=8080, debug=True)