"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zaqar/transport/wsgi/v1_1/queues.py" between
zaqar-9.0.0.tar.gz and zaqar-10.0.0.tar.gz

About: OpenStack Zaqar is a multi-tenant cloud messaging and notification service for web and mobile developers.
The "Ussuri" series (latest release).

queues.py  (zaqar-9.0.0):queues.py  (zaqar-10.0.0)
skipping to change at line 49 skipping to change at line 49
@decorators.TransportLog("Queue metadata") @decorators.TransportLog("Queue metadata")
def on_get(self, req, resp, project_id, queue_name): def on_get(self, req, resp, project_id, queue_name):
try: try:
resp_dict = self._queue_controller.get(queue_name, resp_dict = self._queue_controller.get(queue_name,
project=project_id) project=project_id)
except storage_errors.DoesNotExist as ex: except storage_errors.DoesNotExist as ex:
LOG.debug(ex) LOG.debug(ex)
raise wsgi_errors.HTTPNotFound(six.text_type(ex)) raise wsgi_errors.HTTPNotFound(six.text_type(ex))
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Queue metadata could not be retrieved.') description = _(u'Queue metadata could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
resp.body = utils.to_json(resp_dict) resp.body = utils.to_json(resp_dict)
# status defaults to 200 # status defaults to 200
@decorators.TransportLog("Queue item") @decorators.TransportLog("Queue item")
def on_put(self, req, resp, project_id, queue_name): def on_put(self, req, resp, project_id, queue_name):
try: try:
# Place JSON size restriction before parsing # Place JSON size restriction before parsing
self._validate.queue_metadata_length(req.content_length) self._validate.queue_metadata_length(req.content_length)
skipping to change at line 82 skipping to change at line 82
except validation.ValidationFailed as ex: except validation.ValidationFailed as ex:
LOG.debug(ex) LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex)) raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
try: try:
created = self._queue_controller.create(queue_name, created = self._queue_controller.create(queue_name,
metadata=metadata, metadata=metadata,
project=project_id) project=project_id)
except storage_errors.FlavorDoesNotExist as ex: except storage_errors.FlavorDoesNotExist as ex:
LOG.exception(ex) LOG.exception('"%s" does not exist', queue_name)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex)) raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Queue could not be created.') description = _(u'Queue could not be created.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
resp.status = falcon.HTTP_201 if created else falcon.HTTP_204 resp.status = falcon.HTTP_201 if created else falcon.HTTP_204
resp.location = req.path resp.location = req.path
@decorators.TransportLog("Queue item") @decorators.TransportLog("Queue item")
def on_delete(self, req, resp, project_id, queue_name): def on_delete(self, req, resp, project_id, queue_name):
try: try:
self._queue_controller.delete(queue_name, project=project_id) self._queue_controller.delete(queue_name, project=project_id)
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Queue could not be deleted.') description = _(u'Queue could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
resp.status = falcon.HTTP_204 resp.status = falcon.HTTP_204
class CollectionResource(object): class CollectionResource(object):
__slots__ = ('_queue_controller', '_validate') __slots__ = ('_queue_controller', '_validate')
def __init__(self, validate, queue_controller): def __init__(self, validate, queue_controller):
self._queue_controller = queue_controller self._queue_controller = queue_controller
skipping to change at line 134 skipping to change at line 134
self._validate.queue_listing(**kwargs) self._validate.queue_listing(**kwargs)
results = self._queue_controller.list(project=project_id, **kwargs) results = self._queue_controller.list(project=project_id, **kwargs)
# Buffer list of queues # Buffer list of queues
queues = list(next(results)) queues = list(next(results))
except validation.ValidationFailed as ex: except validation.ValidationFailed as ex:
LOG.debug(ex) LOG.debug(ex)
raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex)) raise wsgi_errors.HTTPBadRequestAPI(six.text_type(ex))
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Queues could not be listed.') description = _(u'Queues could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
# Got some. Prepare the response. # Got some. Prepare the response.
kwargs['marker'] = next(results) or kwargs.get('marker', '') kwargs['marker'] = next(results) or kwargs.get('marker', '')
for each_queue in queues: for each_queue in queues:
each_queue['href'] = req.path + '/' + each_queue['name'] each_queue['href'] = req.path + '/' + each_queue['name']
links = [] links = []
if queues: if queues:
links = [ links = [
 End of changes. 9 change blocks. 
9 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)