Merge "Add _ prefix to local variables"
This commit is contained in:
commit
54483cb5c7
@ -33,13 +33,13 @@ class NamedUnicodeStr(six.text_type):
|
||||
"""Unicode string look-alike to facilitate overriding __name__."""
|
||||
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
self._value = value
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
return self._value
|
||||
|
||||
def encode(self, enc):
|
||||
return self.value.encode(enc)
|
||||
return self._value.encode(enc)
|
||||
|
||||
def __format__(self, formatstr):
|
||||
"""Workaround for ddt bug.
|
||||
|
@ -44,13 +44,13 @@ class Request(object):
|
||||
self._api = None
|
||||
self._api_mod = api
|
||||
|
||||
self.operation = operation
|
||||
self.content = content
|
||||
self.params = params or {}
|
||||
self.headers = headers or {}
|
||||
self._operation = operation
|
||||
self._content = content
|
||||
self._params = params or {}
|
||||
self._headers = headers or {}
|
||||
|
||||
@decorators.lazy_property()
|
||||
def deserialized_content(self):
|
||||
if self.content is not None:
|
||||
return json.loads(self.content)
|
||||
if self._content is not None:
|
||||
return json.loads(self._content)
|
||||
return None
|
||||
|
@ -29,9 +29,9 @@ class Response(object):
|
||||
:type: dict
|
||||
"""
|
||||
|
||||
__slots__ = ('request', 'content', 'headers')
|
||||
__slots__ = ('_request', '_content', '_headers')
|
||||
|
||||
def __init__(self, request, content, headers=None):
|
||||
self.request = request
|
||||
self.content = content
|
||||
self.headers = headers or {}
|
||||
self._request = request
|
||||
self._content = content
|
||||
self._headers = headers or {}
|
||||
|
@ -32,10 +32,10 @@ CLAIM_PATCH_SPEC = (('ttl', int, None),)
|
||||
|
||||
class Resource(object):
|
||||
|
||||
__slots__ = ('claim_controller', '_validate')
|
||||
__slots__ = ('_claim_controller', '_validate')
|
||||
|
||||
def __init__(self, wsgi_conf, validate, claim_controller):
|
||||
self.claim_controller = claim_controller
|
||||
self._claim_controller = claim_controller
|
||||
self._validate = validate
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class CollectionResource(Resource):
|
||||
# Claim some messages
|
||||
try:
|
||||
self._validate.claim_creation(metadata, limit=limit)
|
||||
cid, msgs = self.claim_controller.create(
|
||||
cid, msgs = self._claim_controller.create(
|
||||
queue_name,
|
||||
metadata=metadata,
|
||||
project=project_id,
|
||||
@ -92,10 +92,10 @@ class CollectionResource(Resource):
|
||||
|
||||
class ItemResource(Resource):
|
||||
|
||||
__slots__ = ('claim_controller', '_validate')
|
||||
__slots__ = ('_claim_controller', '_validate')
|
||||
|
||||
def __init__(self, wsgi_conf, validate, claim_controller):
|
||||
self.claim_controller = claim_controller
|
||||
self._claim_controller = claim_controller
|
||||
self._validate = validate
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name, claim_id):
|
||||
@ -105,7 +105,7 @@ class ItemResource(Resource):
|
||||
'project_id': project_id,
|
||||
'claim_id': claim_id})
|
||||
try:
|
||||
meta, msgs = self.claim_controller.get(
|
||||
meta, msgs = self._claim_controller.get(
|
||||
queue_name,
|
||||
claim_id=claim_id,
|
||||
project=project_id)
|
||||
@ -149,10 +149,10 @@ class ItemResource(Resource):
|
||||
|
||||
try:
|
||||
self._validate.claim_updating(metadata)
|
||||
self.claim_controller.update(queue_name,
|
||||
claim_id=claim_id,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
self._claim_controller.update(queue_name,
|
||||
claim_id=claim_id,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@ -176,9 +176,9 @@ class ItemResource(Resource):
|
||||
'project_id': project_id,
|
||||
'claim_id': claim_id})
|
||||
try:
|
||||
self.claim_controller.delete(queue_name,
|
||||
claim_id=claim_id,
|
||||
project=project_id)
|
||||
self._claim_controller.delete(queue_name,
|
||||
claim_id=claim_id,
|
||||
project=project_id)
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
@ -17,13 +17,13 @@ import falcon
|
||||
|
||||
class Resource(object):
|
||||
|
||||
__slots__ = ('driver',)
|
||||
__slots__ = ('_driver',)
|
||||
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
self._driver = driver
|
||||
|
||||
def on_get(self, req, resp, **kwargs):
|
||||
resp.status = (falcon.HTTP_204 if self.driver.is_alive()
|
||||
resp.status = (falcon.HTTP_204 if self._driver.is_alive()
|
||||
else falcon.HTTP_503)
|
||||
|
||||
def on_head(self, req, resp, **kwargs):
|
||||
|
@ -32,12 +32,12 @@ MESSAGE_POST_SPEC = (('ttl', int, None), ('body', '*', None))
|
||||
|
||||
class CollectionResource(object):
|
||||
|
||||
__slots__ = ('message_controller', '_wsgi_conf', '_validate')
|
||||
__slots__ = ('_message_controller', '_wsgi_conf', '_validate')
|
||||
|
||||
def __init__(self, wsgi_conf, validate, message_controller):
|
||||
self._wsgi_conf = wsgi_conf
|
||||
self._validate = validate
|
||||
self.message_controller = message_controller
|
||||
self._message_controller = message_controller
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Helpers
|
||||
@ -47,7 +47,7 @@ class CollectionResource(object):
|
||||
"""Returns one or more messages from the queue by ID."""
|
||||
try:
|
||||
self._validate.message_listing(limit=len(ids))
|
||||
messages = self.message_controller.bulk_get(
|
||||
messages = self._message_controller.bulk_get(
|
||||
queue_name,
|
||||
message_ids=ids,
|
||||
project=project_id)
|
||||
@ -81,7 +81,7 @@ class CollectionResource(object):
|
||||
|
||||
try:
|
||||
self._validate.message_listing(**kwargs)
|
||||
results = self.message_controller.list(
|
||||
results = self._message_controller.list(
|
||||
queue_name,
|
||||
project=project_id,
|
||||
client_uuid=client_uuid,
|
||||
@ -149,7 +149,7 @@ class CollectionResource(object):
|
||||
try:
|
||||
self._validate.message_posting(messages)
|
||||
|
||||
message_ids = self.message_controller.post(
|
||||
message_ids = self._message_controller.post(
|
||||
queue_name,
|
||||
messages=messages,
|
||||
project=project_id,
|
||||
@ -217,7 +217,7 @@ class CollectionResource(object):
|
||||
|
||||
try:
|
||||
self._validate.message_listing(limit=len(ids))
|
||||
self.message_controller.bulk_delete(
|
||||
self._message_controller.bulk_delete(
|
||||
queue_name,
|
||||
message_ids=ids,
|
||||
project=project_id)
|
||||
@ -236,10 +236,10 @@ class CollectionResource(object):
|
||||
|
||||
class ItemResource(object):
|
||||
|
||||
__slots__ = ('message_controller')
|
||||
__slots__ = ('_message_controller')
|
||||
|
||||
def __init__(self, message_controller):
|
||||
self.message_controller = message_controller
|
||||
self._message_controller = message_controller
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name, message_id):
|
||||
LOG.debug(u'Messages item GET - message: %(message)s, '
|
||||
@ -248,7 +248,7 @@ class ItemResource(object):
|
||||
'queue': queue_name,
|
||||
'project': project_id})
|
||||
try:
|
||||
message = self.message_controller.get(
|
||||
message = self._message_controller.get(
|
||||
queue_name,
|
||||
message_id,
|
||||
project=project_id)
|
||||
@ -279,7 +279,7 @@ class ItemResource(object):
|
||||
error_title = _(u'Unable to delete')
|
||||
|
||||
try:
|
||||
self.message_controller.delete(
|
||||
self._message_controller.delete(
|
||||
queue_name,
|
||||
message_id=message_id,
|
||||
project=project_id,
|
||||
|
@ -29,12 +29,12 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Resource(object):
|
||||
__slots__ = ('_wsgi_conf', '_validate', 'queue_ctrl')
|
||||
__slots__ = ('_wsgi_conf', '_validate', '_queue_ctrl')
|
||||
|
||||
def __init__(self, _wsgi_conf, validate, queue_controller):
|
||||
self._wsgi_conf = _wsgi_conf
|
||||
self._validate = validate
|
||||
self.queue_ctrl = queue_controller
|
||||
self._queue_ctrl = queue_controller
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name):
|
||||
LOG.debug(u'Queue metadata GET - queue: %(queue)s, '
|
||||
@ -42,8 +42,8 @@ class Resource(object):
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
|
||||
try:
|
||||
resp_dict = self.queue_ctrl.get_metadata(queue_name,
|
||||
project=project_id)
|
||||
resp_dict = self._queue_ctrl.get_metadata(queue_name,
|
||||
project=project_id)
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
@ -75,9 +75,9 @@ class Resource(object):
|
||||
metadata = wsgi_utils.sanitize(document, spec=None)
|
||||
|
||||
try:
|
||||
self.queue_ctrl.set_metadata(queue_name,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
self._queue_ctrl.set_metadata(queue_name,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
|
@ -28,11 +28,11 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class ItemResource(object):
|
||||
|
||||
__slots__ = ('queue_controller', 'message_controller')
|
||||
__slots__ = ('_queue_controller', '_message_controller')
|
||||
|
||||
def __init__(self, queue_controller, message_controller):
|
||||
self.queue_controller = queue_controller
|
||||
self.message_controller = message_controller
|
||||
self._queue_controller = queue_controller
|
||||
self._message_controller = message_controller
|
||||
|
||||
def on_put(self, req, resp, project_id, queue_name):
|
||||
LOG.debug(u'Queue item PUT - queue: %(queue)s, '
|
||||
@ -40,7 +40,7 @@ class ItemResource(object):
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
|
||||
try:
|
||||
created = self.queue_controller.create(
|
||||
created = self._queue_controller.create(
|
||||
queue_name, project=project_id)
|
||||
|
||||
except Exception as ex:
|
||||
@ -56,7 +56,7 @@ class ItemResource(object):
|
||||
u'project: %(project)s',
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
|
||||
if self.queue_controller.exists(queue_name, project=project_id):
|
||||
if self._queue_controller.exists(queue_name, project=project_id):
|
||||
resp.status = falcon.HTTP_204
|
||||
else:
|
||||
resp.status = falcon.HTTP_404
|
||||
@ -70,7 +70,7 @@ class ItemResource(object):
|
||||
u'project: %(project)s',
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
try:
|
||||
self.queue_controller.delete(queue_name, project=project_id)
|
||||
self._queue_controller.delete(queue_name, project=project_id)
|
||||
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
@ -82,10 +82,10 @@ class ItemResource(object):
|
||||
|
||||
class CollectionResource(object):
|
||||
|
||||
__slots__ = ('queue_controller', '_validate')
|
||||
__slots__ = ('_queue_controller', '_validate')
|
||||
|
||||
def __init__(self, validate, queue_controller):
|
||||
self.queue_controller = queue_controller
|
||||
self._queue_controller = queue_controller
|
||||
self._validate = validate
|
||||
|
||||
def on_get(self, req, resp, project_id):
|
||||
@ -102,7 +102,7 @@ class CollectionResource(object):
|
||||
|
||||
try:
|
||||
self._validate.queue_listing(**kwargs)
|
||||
results = self.queue_controller.list(project=project_id, **kwargs)
|
||||
results = self._queue_controller.list(project=project_id, **kwargs)
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
|
@ -27,15 +27,15 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class Resource(object):
|
||||
|
||||
__slots__ = ('queue_ctrl')
|
||||
__slots__ = ('_queue_ctrl')
|
||||
|
||||
def __init__(self, queue_controller):
|
||||
self.queue_ctrl = queue_controller
|
||||
self._queue_ctrl = queue_controller
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name):
|
||||
try:
|
||||
resp_dict = self.queue_ctrl.stats(queue_name,
|
||||
project=project_id)
|
||||
resp_dict = self._queue_ctrl.stats(queue_name,
|
||||
project=project_id)
|
||||
|
||||
message_stats = resp_dict['messages']
|
||||
|
||||
|
@ -32,7 +32,7 @@ CLAIM_PATCH_SPEC = (('ttl', int, None),)
|
||||
class CollectionResource(object):
|
||||
|
||||
__slots__ = (
|
||||
'claim_controller',
|
||||
'_claim_controller',
|
||||
'_validate',
|
||||
'_claim_post_spec',
|
||||
'_default_meta',
|
||||
@ -41,7 +41,7 @@ class CollectionResource(object):
|
||||
def __init__(self, wsgi_conf, validate, claim_controller,
|
||||
default_claim_ttl, default_grace_ttl):
|
||||
|
||||
self.claim_controller = claim_controller
|
||||
self._claim_controller = claim_controller
|
||||
self._validate = validate
|
||||
|
||||
self._claim_post_spec = (
|
||||
@ -81,7 +81,7 @@ class CollectionResource(object):
|
||||
try:
|
||||
self._validate.claim_creation(metadata, limit=limit)
|
||||
|
||||
cid, msgs = self.claim_controller.create(
|
||||
cid, msgs = self._claim_controller.create(
|
||||
queue_name,
|
||||
metadata=metadata,
|
||||
project=project_id,
|
||||
@ -118,10 +118,10 @@ class CollectionResource(object):
|
||||
|
||||
class ItemResource(object):
|
||||
|
||||
__slots__ = ('claim_controller', '_validate')
|
||||
__slots__ = ('_claim_controller', '_validate')
|
||||
|
||||
def __init__(self, wsgi_conf, validate, claim_controller):
|
||||
self.claim_controller = claim_controller
|
||||
self._claim_controller = claim_controller
|
||||
self._validate = validate
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name, claim_id):
|
||||
@ -131,7 +131,7 @@ class ItemResource(object):
|
||||
'project_id': project_id,
|
||||
'claim_id': claim_id})
|
||||
try:
|
||||
meta, msgs = self.claim_controller.get(
|
||||
meta, msgs = self._claim_controller.get(
|
||||
queue_name,
|
||||
claim_id=claim_id,
|
||||
project=project_id)
|
||||
@ -175,10 +175,10 @@ class ItemResource(object):
|
||||
|
||||
try:
|
||||
self._validate.claim_updating(metadata)
|
||||
self.claim_controller.update(queue_name,
|
||||
claim_id=claim_id,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
self._claim_controller.update(queue_name,
|
||||
claim_id=claim_id,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
@ -202,9 +202,9 @@ class ItemResource(object):
|
||||
'project_id': project_id,
|
||||
'claim_id': claim_id})
|
||||
try:
|
||||
self.claim_controller.delete(queue_name,
|
||||
claim_id=claim_id,
|
||||
project=project_id)
|
||||
self._claim_controller.delete(queue_name,
|
||||
claim_id=claim_id,
|
||||
project=project_id)
|
||||
|
||||
resp.status = falcon.HTTP_204
|
||||
|
||||
|
@ -23,15 +23,14 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class Resource(object):
|
||||
|
||||
__slots__ = ('driver',)
|
||||
__slots__ = ('_driver',)
|
||||
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
self._driver = driver
|
||||
|
||||
def on_get(self, req, resp, **kwargs):
|
||||
try:
|
||||
resp_dict = self.driver.health()
|
||||
|
||||
resp_dict = self._driver.health()
|
||||
resp.body = utils.to_json(resp_dict)
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
|
@ -31,8 +31,8 @@ LOG = logging.getLogger(__name__)
|
||||
class CollectionResource(object):
|
||||
|
||||
__slots__ = (
|
||||
'message_controller',
|
||||
'queue_controller',
|
||||
'_message_controller',
|
||||
'_queue_controller',
|
||||
'_wsgi_conf',
|
||||
'_validate',
|
||||
'_message_post_spec',
|
||||
@ -44,8 +44,8 @@ class CollectionResource(object):
|
||||
|
||||
self._wsgi_conf = wsgi_conf
|
||||
self._validate = validate
|
||||
self.message_controller = message_controller
|
||||
self.queue_controller = queue_controller
|
||||
self._message_controller = message_controller
|
||||
self._queue_controller = queue_controller
|
||||
|
||||
self._message_post_spec = (
|
||||
('ttl', int, default_message_ttl),
|
||||
@ -60,7 +60,7 @@ class CollectionResource(object):
|
||||
"""Returns one or more messages from the queue by ID."""
|
||||
try:
|
||||
self._validate.message_listing(limit=len(ids))
|
||||
messages = self.message_controller.bulk_get(
|
||||
messages = self._message_controller.bulk_get(
|
||||
queue_name,
|
||||
message_ids=ids,
|
||||
project=project_id)
|
||||
@ -96,7 +96,7 @@ class CollectionResource(object):
|
||||
|
||||
try:
|
||||
self._validate.message_listing(**kwargs)
|
||||
results = self.message_controller.list(
|
||||
results = self._message_controller.list(
|
||||
queue_name,
|
||||
project=project_id,
|
||||
client_uuid=client_uuid,
|
||||
@ -170,10 +170,10 @@ class CollectionResource(object):
|
||||
try:
|
||||
self._validate.message_posting(messages)
|
||||
|
||||
if not self.queue_controller.exists(queue_name, project_id):
|
||||
self.queue_controller.create(queue_name, project=project_id)
|
||||
if not self._queue_controller.exists(queue_name, project_id):
|
||||
self._queue_controller.create(queue_name, project=project_id)
|
||||
|
||||
message_ids = self.message_controller.post(
|
||||
message_ids = self._message_controller.post(
|
||||
queue_name,
|
||||
messages=messages,
|
||||
project=project_id,
|
||||
@ -255,7 +255,7 @@ class CollectionResource(object):
|
||||
|
||||
def _delete_messages_by_id(self, queue_name, ids, project_id):
|
||||
try:
|
||||
self.message_controller.bulk_delete(
|
||||
self._message_controller.bulk_delete(
|
||||
queue_name,
|
||||
message_ids=ids,
|
||||
project=project_id)
|
||||
@ -273,7 +273,7 @@ class CollectionResource(object):
|
||||
u'project: %(project)s',
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
|
||||
messages = self.message_controller.pop(
|
||||
messages = self._message_controller.pop(
|
||||
queue_name,
|
||||
project=project_id,
|
||||
limit=pop_limit)
|
||||
@ -294,10 +294,10 @@ class CollectionResource(object):
|
||||
|
||||
class ItemResource(object):
|
||||
|
||||
__slots__ = ('message_controller')
|
||||
__slots__ = ('_message_controller')
|
||||
|
||||
def __init__(self, message_controller):
|
||||
self.message_controller = message_controller
|
||||
self._message_controller = message_controller
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name, message_id):
|
||||
LOG.debug(u'Messages item GET - message: %(message)s, '
|
||||
@ -306,7 +306,7 @@ class ItemResource(object):
|
||||
'queue': queue_name,
|
||||
'project': project_id})
|
||||
try:
|
||||
message = self.message_controller.get(
|
||||
message = self._message_controller.get(
|
||||
queue_name,
|
||||
message_id,
|
||||
project=project_id)
|
||||
@ -338,7 +338,7 @@ class ItemResource(object):
|
||||
error_title = _(u'Unable to delete')
|
||||
|
||||
try:
|
||||
self.message_controller.delete(
|
||||
self._message_controller.delete(
|
||||
queue_name,
|
||||
message_id=message_id,
|
||||
project=project_id,
|
||||
|
@ -17,13 +17,13 @@ import falcon
|
||||
|
||||
class Resource(object):
|
||||
|
||||
__slots__ = ('driver',)
|
||||
__slots__ = ('_driver',)
|
||||
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
self._driver = driver
|
||||
|
||||
def on_get(self, req, resp, **kwargs):
|
||||
resp.status = (falcon.HTTP_204 if self.driver.is_alive()
|
||||
resp.status = (falcon.HTTP_204 if self._driver.is_alive()
|
||||
else falcon.HTTP_503)
|
||||
|
||||
def on_head(self, req, resp, **kwargs):
|
||||
|
@ -30,12 +30,12 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class ItemResource(object):
|
||||
|
||||
__slots__ = ('validate', 'queue_controller', 'message_controller')
|
||||
__slots__ = ('_validate', '_queue_controller', '_message_controller')
|
||||
|
||||
def __init__(self, validate, queue_controller, message_controller):
|
||||
self.validate = validate
|
||||
self.queue_controller = queue_controller
|
||||
self.message_controller = message_controller
|
||||
self._validate = validate
|
||||
self._queue_controller = queue_controller
|
||||
self._message_controller = message_controller
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name):
|
||||
LOG.debug(u'Queue metadata GET - queue: %(queue)s, '
|
||||
@ -43,8 +43,8 @@ class ItemResource(object):
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
|
||||
try:
|
||||
resp_dict = self.queue_controller.get(queue_name,
|
||||
project=project_id)
|
||||
resp_dict = self._queue_controller.get(queue_name,
|
||||
project=project_id)
|
||||
|
||||
except storage_errors.DoesNotExist as ex:
|
||||
LOG.debug(ex)
|
||||
@ -65,7 +65,7 @@ class ItemResource(object):
|
||||
|
||||
try:
|
||||
# Place JSON size restriction before parsing
|
||||
self.validate.queue_metadata_length(req.content_length)
|
||||
self._validate.queue_metadata_length(req.content_length)
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
|
||||
@ -77,9 +77,9 @@ class ItemResource(object):
|
||||
metadata = wsgi_utils.sanitize(document, spec=None)
|
||||
|
||||
try:
|
||||
created = self.queue_controller.create(queue_name,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
created = self._queue_controller.create(queue_name,
|
||||
metadata=metadata,
|
||||
project=project_id)
|
||||
|
||||
except storage_errors.FlavorDoesNotExist as ex:
|
||||
LOG.exception(ex)
|
||||
@ -98,7 +98,7 @@ class ItemResource(object):
|
||||
u'project: %(project)s',
|
||||
{'queue': queue_name, 'project': project_id})
|
||||
try:
|
||||
self.queue_controller.delete(queue_name, project=project_id)
|
||||
self._queue_controller.delete(queue_name, project=project_id)
|
||||
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
@ -110,10 +110,10 @@ class ItemResource(object):
|
||||
|
||||
class CollectionResource(object):
|
||||
|
||||
__slots__ = ('queue_controller', '_validate')
|
||||
__slots__ = ('_queue_controller', '_validate')
|
||||
|
||||
def __init__(self, validate, queue_controller):
|
||||
self.queue_controller = queue_controller
|
||||
self._queue_controller = queue_controller
|
||||
self._validate = validate
|
||||
|
||||
def on_get(self, req, resp, project_id):
|
||||
@ -130,7 +130,7 @@ class CollectionResource(object):
|
||||
|
||||
try:
|
||||
self._validate.queue_listing(**kwargs)
|
||||
results = self.queue_controller.list(project=project_id, **kwargs)
|
||||
results = self._queue_controller.list(project=project_id, **kwargs)
|
||||
|
||||
except validation.ValidationFailed as ex:
|
||||
LOG.debug(ex)
|
||||
|
@ -27,15 +27,15 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class Resource(object):
|
||||
|
||||
__slots__ = ('queue_ctrl')
|
||||
__slots__ = ('_queue_ctrl')
|
||||
|
||||
def __init__(self, queue_controller):
|
||||
self.queue_ctrl = queue_controller
|
||||
self._queue_ctrl = queue_controller
|
||||
|
||||
def on_get(self, req, resp, project_id, queue_name):
|
||||
try:
|
||||
resp_dict = self.queue_ctrl.stats(queue_name,
|
||||
project=project_id)
|
||||
resp_dict = self._queue_ctrl.stats(queue_name,
|
||||
project=project_id)
|
||||
|
||||
message_stats = resp_dict['messages']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user