Example #1
0
 def handle_none_version_id(req, res, result):
     for version in VERSIONS:
         VERSIONS[version]['links'][0]['href'] = (
             req.uri.decode('utf8') + version)
         result['elements'].append(VERSIONS[version])
     res.body = rest_utils.as_json(result)
     res.status = falcon.HTTP_200
Example #2
0
 def handle_version_id(req, res, version_id):
     if version_id in VERSIONS:
         VERSIONS[version_id]['links'][0]['href'] = (
             req.uri.decode(rest_utils.ENCODING)
         )
         for version in VERSIONS:
             VERSIONS[version]['links'][0]['href'] = (
                 req.uri.decode('utf8')
             )
         VERSIONS[version_id]['links'][1]['href'] = (
             req.uri.decode('utf8') +
             VERSIONS[version_id]['links'][1]['href']
         )
         res.body = rest_utils.as_json(VERSIONS[version_id])
         res.status = falcon.HTTP_200
     else:
         res.body = 'Invalid Version ID'
         res.status = falcon.HTTP_400