Archiving a bunch of old stuff
This commit is contained in:
18
oldstuff/activeresource-aspen/www/families.json
Normal file
18
oldstuff/activeresource-aspen/www/families.json
Normal file
@@ -0,0 +1,18 @@
|
||||
from server.families import Families
|
||||
from server.helpers import json_loads_from_request
|
||||
|
||||
__families__ = Families()
|
||||
|
||||
|
||||
|
||||
if GET:
|
||||
response.body = __families__.getall()
|
||||
elif POST:
|
||||
family = json_loads_from_request(request)['family']
|
||||
family_id = __families__.add(family)
|
||||
response.headers['Location'] = '/families/{}.json'.format(family_id)
|
||||
family['id'] = family_id
|
||||
response.body = family
|
||||
response.code = 201
|
||||
|
||||
# vim:filetype=python
|
||||
Reference in New Issue
Block a user