2. Víctor Fernández de Alba
Lead web developer at Barcelona Tech University
Author of Plone 3 Intranets (2010, PacktPub)
Developing Plone sites since 2004
Developing Pyramid applications since its early betas
- /Víctor's Blog @sneridagh
18. Cornice: A REST framework for
Pyramid
[..]
from cornice import Service
info_desc = """This service is useful to get and set data for a user."""
user_info = Service(name='users', path='/{username}/info',
description=info_desc)
_USERS = defaultdict(dict)
@user_info.get()
def get_info(request):
"""Returns the public information about a **user**.
If the user does not exists, returns an empty dataset.
"""
username = request.matchdict['username']
return _USERS[username]