-
-
Save mansam/c3a0bee64a5b0334f97c to your computer and use it in GitHub Desktop.
This file contains 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
@user.get(accept=("application/json", "text/json")) | |
def get_user_json(request): | |
db = request.db | |
id = request.matchdict.get('name') | |
user = db.query(User).filter(or_( | |
User.id==id, | |
User.name==id, | |
)).first() | |
if not user: | |
request.errors.add('body', 'name', 'No such .') | |
return | |
return user.__json__() | |
@user.get(accept="text/html", renderer="services/user.html") | |
def get_user_html(request): | |
return "user chrome" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment