Merge "HACKING: Use single quotes"
This commit is contained in:
commit
103f692fd7
|
@ -15,6 +15,7 @@ General
|
||||||
- Include your name with TODOs as in "#TODO(termie)"
|
- Include your name with TODOs as in "#TODO(termie)"
|
||||||
- Do not name anything the same name as a built-in or reserved word
|
- Do not name anything the same name as a built-in or reserved word
|
||||||
- When defining global constants, define them before functions and classes
|
- When defining global constants, define them before functions and classes
|
||||||
|
- Avoid using "double quotes" where you can reasonably use 'single quotes'
|
||||||
|
|
||||||
|
|
||||||
TODO vs FIXME
|
TODO vs FIXME
|
||||||
|
@ -25,6 +26,7 @@ TODO vs FIXME
|
||||||
- FIXME(name): implies that the method/function/etc shouldn't be used until
|
- FIXME(name): implies that the method/function/etc shouldn't be used until
|
||||||
that code is resolved and bug fixed.
|
that code is resolved and bug fixed.
|
||||||
|
|
||||||
|
|
||||||
Logging
|
Logging
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ Use the built-in logging module, and ensure you ``getLogger``::
|
||||||
|
|
||||||
LOG.debug('Foobar')
|
LOG.debug('Foobar')
|
||||||
|
|
||||||
|
|
||||||
Imports
|
Imports
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ class AdminVersionRouter(wsgi.ComposingRouter):
|
||||||
class VersionController(wsgi.Application):
|
class VersionController(wsgi.Application):
|
||||||
def __init__(self, version_type):
|
def __init__(self, version_type):
|
||||||
self.catalog_api = catalog.Manager()
|
self.catalog_api = catalog.Manager()
|
||||||
self.url_key = "%sURL" % version_type
|
self.url_key = '%sURL' % version_type
|
||||||
|
|
||||||
super(VersionController, self).__init__()
|
super(VersionController, self).__init__()
|
||||||
|
|
||||||
|
@ -186,35 +186,35 @@ class VersionController(wsgi.Application):
|
||||||
|
|
||||||
versions = {}
|
versions = {}
|
||||||
versions['v2.0'] = {
|
versions['v2.0'] = {
|
||||||
"id": "v2.0",
|
'id': 'v2.0',
|
||||||
"status": "beta",
|
'status': 'beta',
|
||||||
"updated": "2011-11-19T00:00:00Z",
|
'updated': '2011-11-19T00:00:00Z',
|
||||||
"links": [
|
'links': [
|
||||||
{
|
{
|
||||||
"rel": "self",
|
'rel': 'self',
|
||||||
"href": identity_url,
|
'href': identity_url,
|
||||||
}, {
|
}, {
|
||||||
"rel": "describedby",
|
'rel': 'describedby',
|
||||||
"type": "text/html",
|
'type': 'text/html',
|
||||||
"href": "http://docs.openstack.org/api/openstack-"
|
'href': 'http://docs.openstack.org/api/openstack-'
|
||||||
"identity-service/2.0/content/"
|
'identity-service/2.0/content/'
|
||||||
}, {
|
}, {
|
||||||
"rel": "describedby",
|
'rel': 'describedby',
|
||||||
"type": "application/pdf",
|
'type': 'application/pdf',
|
||||||
"href": "http://docs.openstack.org/api/openstack-"
|
'href': 'http://docs.openstack.org/api/openstack-'
|
||||||
"identity-service/2.0/identity-dev-guide-"
|
'identity-service/2.0/identity-dev-guide-'
|
||||||
"2.0.pdf"
|
'2.0.pdf'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"media-types": [
|
'media-types': [
|
||||||
{
|
{
|
||||||
"base": "application/json",
|
'base': 'application/json',
|
||||||
"type": "application/vnd.openstack.identity-v2.0"
|
'type': 'application/vnd.openstack.identity-v2.0'
|
||||||
"+json"
|
'+json'
|
||||||
}, {
|
}, {
|
||||||
"base": "application/xml",
|
'base': 'application/xml',
|
||||||
"type": "application/vnd.openstack.identity-v2.0"
|
'type': 'application/vnd.openstack.identity-v2.0'
|
||||||
"+xml"
|
'+xml'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -224,15 +224,15 @@ class VersionController(wsgi.Application):
|
||||||
def get_versions(self, context):
|
def get_versions(self, context):
|
||||||
versions = self._get_versions_list(context)
|
versions = self._get_versions_list(context)
|
||||||
return wsgi.render_response(status=(300, 'Multiple Choices'), body={
|
return wsgi.render_response(status=(300, 'Multiple Choices'), body={
|
||||||
"versions": {
|
'versions': {
|
||||||
"values": versions.values()
|
'values': versions.values()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
def get_version(self, context):
|
def get_version(self, context):
|
||||||
versions = self._get_versions_list(context)
|
versions = self._get_versions_list(context)
|
||||||
return wsgi.render_response(body={
|
return wsgi.render_response(body={
|
||||||
"version": versions['v2.0']
|
'version': versions['v2.0']
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -433,17 +433,17 @@ class TokenController(wsgi.Application):
|
||||||
service_catalog = self._format_catalog(catalog_ref)
|
service_catalog = self._format_catalog(catalog_ref)
|
||||||
token_data['access']['serviceCatalog'] = service_catalog
|
token_data['access']['serviceCatalog'] = service_catalog
|
||||||
|
|
||||||
if config.CONF.signing.token_format == "UUID":
|
if config.CONF.signing.token_format == 'UUID':
|
||||||
token_id = uuid.uuid4().hex
|
token_id = uuid.uuid4().hex
|
||||||
elif config.CONF.signing.token_format == "PKI":
|
elif config.CONF.signing.token_format == 'PKI':
|
||||||
|
|
||||||
token_id = cms.cms_sign_token(json.dumps(token_data),
|
token_id = cms.cms_sign_token(json.dumps(token_data),
|
||||||
config.CONF.signing.certfile,
|
config.CONF.signing.certfile,
|
||||||
config.CONF.signing.keyfile)
|
config.CONF.signing.keyfile)
|
||||||
else:
|
else:
|
||||||
raise exception.UnexpectedError(
|
raise exception.UnexpectedError(
|
||||||
"Invalid value for token_format: %s."
|
'Invalid value for token_format: %s.'
|
||||||
" Allowed values are PKI or UUID." %
|
' Allowed values are PKI or UUID.' %
|
||||||
config.CONF.signing.token_format)
|
config.CONF.signing.token_format)
|
||||||
try:
|
try:
|
||||||
self.token_api.create_token(
|
self.token_api.create_token(
|
||||||
|
@ -509,7 +509,7 @@ class TokenController(wsgi.Application):
|
||||||
Returns metadata about the token along any associated roles.
|
Returns metadata about the token along any associated roles.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
belongs_to = context['query_string'].get("belongsTo")
|
belongs_to = context['query_string'].get('belongsTo')
|
||||||
token_ref = self._get_token_ref(context, token_id, belongs_to)
|
token_ref = self._get_token_ref(context, token_id, belongs_to)
|
||||||
|
|
||||||
# TODO(termie): optimize this call at some point and put it into the
|
# TODO(termie): optimize this call at some point and put it into the
|
||||||
|
|
Loading…
Reference in New Issue