"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "zaqar/transport/wsgi/v1_1/messages.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).

messages.py  (zaqar-9.0.0):messages.py  (zaqar-10.0.0)
skipping to change at line 72 skipping to change at line 72
self._validate.message_listing(limit=len(ids)) self._validate.message_listing(limit=len(ids))
messages = self._message_controller.bulk_get( messages = self._message_controller.bulk_get(
queue_name, queue_name,
message_ids=ids, message_ids=ids,
project=project_id) project=project_id)
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'Message could not be retrieved.') description = _(u'Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare response # Prepare response
messages = list(messages) messages = list(messages)
if not messages: if not messages:
return None return None
messages = [wsgi_utils.format_message_v1_1(m, base_path, m['claim_id']) messages = [wsgi_utils.format_message_v1_1(m, base_path, m['claim_id'])
for m in messages] for m in messages]
skipping to change at line 118 skipping to change at line 118
messages = list(cursor) messages = list(cursor)
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 storage_errors.QueueDoesNotExist as ex: except storage_errors.QueueDoesNotExist as ex:
LOG.debug(ex) LOG.debug(ex)
messages = None messages = None
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Messages could not be listed.') description = _(u'Messages could not be listed.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
if not messages: if not messages:
messages = [] messages = []
else: else:
# Found some messages, so prepare the response # Found some messages, so prepare the response
kwargs['marker'] = next(results) kwargs['marker'] = next(results)
base_path = req.path.rsplit('/', 1)[0] base_path = req.path.rsplit('/', 1)[0]
messages = [wsgi_utils.format_message_v1_1(m, base_path, messages = [wsgi_utils.format_message_v1_1(m, base_path,
skipping to change at line 194 skipping to change at line 194
client_uuid=client_uuid) client_uuid=client_uuid)
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 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 storage_errors.MessageConflict as ex: except storage_errors.MessageConflict:
LOG.exception(ex)
description = _(u'No messages could be enqueued.') description = _(u'No messages could be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Messages could not be enqueued.') description = _(u'Messages could not be enqueued.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare the response # Prepare the response
ids_value = ','.join(message_ids) ids_value = ','.join(message_ids)
resp.location = req.path + '?ids=' + ids_value resp.location = req.path + '?ids=' + ids_value
hrefs = [req.path + '/' + id for id in message_ids] hrefs = [req.path + '/' + id for id in message_ids]
body = {'resources': hrefs} body = {'resources': hrefs}
resp.body = utils.to_json(body) resp.body = utils.to_json(body)
resp.status = falcon.HTTP_201 resp.status = falcon.HTTP_201
skipping to change at line 265 skipping to change at line 265
project_id, project_id,
pop_limit) pop_limit)
def _delete_messages_by_id(self, queue_name, ids, project_id): def _delete_messages_by_id(self, queue_name, ids, project_id):
try: try:
self._message_controller.bulk_delete( self._message_controller.bulk_delete(
queue_name, queue_name,
message_ids=ids, message_ids=ids,
project=project_id) project=project_id)
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Messages could not be deleted.') description = _(u'Messages could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
return falcon.HTTP_204 return falcon.HTTP_204
def _pop_messages(self, queue_name, project_id, pop_limit): def _pop_messages(self, queue_name, project_id, pop_limit):
try: try:
LOG.debug(u'POP messages - queue: %(queue)s, ' LOG.debug(u'POP messages - queue: %(queue)s, '
u'project: %(project)s', u'project: %(project)s',
{'queue': queue_name, 'project': project_id}) {'queue': queue_name, 'project': project_id})
messages = self._message_controller.pop( messages = self._message_controller.pop(
queue_name, queue_name,
project=project_id, project=project_id,
limit=pop_limit) limit=pop_limit)
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Messages could not be popped.') description = _(u'Messages could not be popped.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare response # Prepare response
if not messages: if not messages:
messages = [] messages = []
body = {'messages': messages} body = {'messages': messages}
body = utils.to_json(body) body = utils.to_json(body)
return falcon.HTTP_200, body return falcon.HTTP_200, body
skipping to change at line 315 skipping to change at line 315
try: try:
message = self._message_controller.get( message = self._message_controller.get(
queue_name, queue_name,
message_id, message_id,
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'Message could not be retrieved.') description = _(u'Message could not be retrieved.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
# Prepare response # Prepare response
message['href'] = req.path message['href'] = req.path
message = wsgi_utils.format_message_v1_1(message, message = wsgi_utils.format_message_v1_1(message,
req.path.rsplit('/', 2)[0], req.path.rsplit('/', 2)[0],
message['claim_id']) message['claim_id'])
resp.body = utils.to_json(message) resp.body = utils.to_json(message)
# status defaults to 200 # status defaults to 200
skipping to change at line 358 skipping to change at line 358
description = _(u'The specified claim does not exist or ' description = _(u'The specified claim does not exist or '
u'has expired.') u'has expired.')
raise falcon.HTTPBadRequest(error_title, description) raise falcon.HTTPBadRequest(error_title, description)
except storage_errors.NotPermitted as ex: except storage_errors.NotPermitted as ex:
LOG.debug(ex) LOG.debug(ex)
description = _(u'This message is claimed; it cannot be ' description = _(u'This message is claimed; it cannot be '
u'deleted without a valid claim ID.') u'deleted without a valid claim ID.')
raise falcon.HTTPForbidden(error_title, description) raise falcon.HTTPForbidden(error_title, description)
except Exception as ex: except Exception:
LOG.exception(ex)
description = _(u'Message could not be deleted.') description = _(u'Message could not be deleted.')
LOG.exception(description)
raise wsgi_errors.HTTPServiceUnavailable(description) raise wsgi_errors.HTTPServiceUnavailable(description)
# Alles guete # Alles guete
resp.status = falcon.HTTP_204 resp.status = falcon.HTTP_204
 End of changes. 16 change blocks. 
16 lines changed or deleted 16 lines changed or added

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