"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zaqar/transport/wsgi/v1_0/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 42 skipping to change at line 42
def __init__(self, queue_controller, message_controller): def __init__(self, queue_controller, message_controller):
self._queue_controller = queue_controller self._queue_controller = queue_controller
self._message_controller = message_controller self._message_controller = message_controller
@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:
created = self._queue_controller.create( created = self._queue_controller.create(
queue_name, project=project_id) queue_name, project=project_id)
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_head(self, req, resp, project_id, queue_name): def on_head(self, req, resp, project_id, queue_name):
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 resp.status = falcon.HTTP_204
else: else:
skipping to change at line 66 skipping to change at line 66
resp.content_location = req.path resp.content_location = req.path
on_get = on_head on_get = on_head
@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 103 skipping to change at line 103
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)
# Check for an empty list # Check for an empty list
if len(queues) == 0: if len(queues) == 0:
resp.status = falcon.HTTP_204 resp.status = falcon.HTTP_204
return return
# Got some. Prepare the response. # Got some. Prepare the response.
kwargs['marker'] = next(results) kwargs['marker'] = next(results)
for each_queue in queues: for each_queue in queues:
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

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