Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Make api better match docs
Browse files Browse the repository at this point in the history
  • Loading branch information
oldpatricka committed Jun 19, 2013
1 parent 73e1c63 commit 1cb6fdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions phantomweb/api/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,14 @@ def site_resource(request, site):
response_dict = {
"id": site,
"credentials": "/api/%s/credentials/sites/%s" % (API_VERSION, site),
"instance_types": all_sites[site].get('instance_types', []),
"uri": "/api/%s/sites/%s" % (API_VERSION, site)
}
if details:
if response_dict.get('user_images') is None:
response_dict['user_images'] = []
if response_dict.get('public_images') is None:
response_dict['public_images'] = []
h = HttpResponse(json.dumps(response_dict), mimetype='application/javascript')
else:
h = HttpResponseNotFound('Site %s not found' % site, mimetype='application/javascript')
Expand Down
2 changes: 2 additions & 0 deletions phantomweb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
url(r'^api/%s/sites$' % DEV_VERSION, 'phantomweb.api.dev.sites'),
url(r'^api/%s/sites(?P<details>\w+)$' % DEV_VERSION, 'phantomweb.api.dev.sites'),
url(r'^api/%s/sites/([-0-9A-Za-z]+)$' % DEV_VERSION, 'phantomweb.api.dev.site_resource'),
url(r'^api/%s/sites/([-0-9A-Za-z]+)(?P<details>\w+)$' % DEV_VERSION, 'phantomweb.api.dev.site_resource'),
url(r'^api/%s/credentials/sites$' % DEV_VERSION, 'phantomweb.api.dev.credentials'),
url(r'^api/%s/credentials/sites(?P<details>\w+)$' % DEV_VERSION, 'phantomweb.api.dev.credentials'),
url(r'^api/%s/credentials/sites/([-0-9A-Za-z]+)$' % DEV_VERSION, 'phantomweb.api.dev.credentials_resource'),
url(r'^api/%s/credentials/sites/([-0-9A-Za-z]+)(?P<details>\w+)$' % DEV_VERSION, 'phantomweb.api.dev.credentials'),
url(r'^api/%s/credentials/chef$' % DEV_VERSION, 'phantomweb.api.dev.chef_credentials'),
url(r'^api/%s/credentials/chef/([-0-9A-Za-z]+)$' % DEV_VERSION, 'phantomweb.api.dev.chef_credentials_resource'),
url(r'^api/%s/launchconfigurations$' % DEV_VERSION, 'phantomweb.api.dev.launchconfigurations'),
Expand Down

0 comments on commit 1cb6fdf

Please sign in to comment.