Example #1
0
 def index(self, format='html'):
     """GET /repository/whoami: All items in the collection"""
     my_uuid = request.environ['REPOSITORY_USER_UUID']
     user = meta.Session.query(User).filter(User.uuid==my_uuid).first()
     if user:
         response.headers['content-type'] = 'text/javascript'
         return json.dumps(user_long(user))
     else:
         abort(404, '404 Not Found')
Example #2
0
 def show(self, id, format='json'):
     """GET /repository/users/id: Show a specific item"""
     user = meta.Session.query(User).filter(User.uuid==id).first()
     if user:
         user_repr = user_long(user)
         if format=='json':
             response.headers['content-type'] = 'text/javascript'
             return json.dumps(user_repr)
     else:
         abort(404, '404 Not Found')