Merge "Deprecate partial field in v1.0, remove in v1.1"
This commit is contained in:
commit
e4abb02c3f
@ -150,9 +150,6 @@ class CollectionResource(object):
|
||||
messages = wsgi_utils.sanitize(document, MESSAGE_POST_SPEC,
|
||||
doctype=wsgi_utils.JSONArray)
|
||||
|
||||
# Enqueue the messages
|
||||
partial = False
|
||||
|
||||
try:
|
||||
self._validate.message_posting(messages)
|
||||
|
||||
@ -172,7 +169,6 @@ class CollectionResource(object):
|
||||
|
||||
except storage_errors.MessageConflict as ex:
|
||||
LOG.exception(ex)
|
||||
partial = True
|
||||
message_ids = ex.succeeded_ids
|
||||
|
||||
if not message_ids:
|
||||
@ -191,7 +187,14 @@ class CollectionResource(object):
|
||||
resp.location = req.path + '?ids=' + ids_value
|
||||
|
||||
hrefs = [req.path + '/' + id for id in message_ids]
|
||||
body = {'resources': hrefs, 'partial': partial}
|
||||
|
||||
# NOTE(kgriffs): As of the Icehouse release, drivers are
|
||||
# no longer allowed to enqueue a subset of the messages
|
||||
# submitted by the client; it's all or nothing. Therefore,
|
||||
# 'partial' is now always False in the v1.0 API, and the
|
||||
# field has been removed in v1.1.
|
||||
body = {'resources': hrefs, 'partial': False}
|
||||
|
||||
resp.body = utils.to_json(body)
|
||||
resp.status = falcon.HTTP_201
|
||||
|
||||
|
@ -170,9 +170,6 @@ class CollectionResource(object):
|
||||
self._message_post_spec,
|
||||
doctype=wsgi_utils.JSONArray)
|
||||
|
||||
# Enqueue the messages
|
||||
partial = False
|
||||
|
||||
try:
|
||||
self._validate.message_posting(messages)
|
||||
|
||||
@ -195,7 +192,6 @@ class CollectionResource(object):
|
||||
|
||||
except storage_errors.MessageConflict as ex:
|
||||
LOG.exception(ex)
|
||||
partial = True
|
||||
message_ids = ex.succeeded_ids
|
||||
|
||||
if not message_ids:
|
||||
@ -214,7 +210,7 @@ class CollectionResource(object):
|
||||
resp.location = req.path + '?ids=' + ids_value
|
||||
|
||||
hrefs = [req.path + '/' + id for id in message_ids]
|
||||
body = {'resources': hrefs, 'partial': partial}
|
||||
body = {'resources': hrefs}
|
||||
resp.body = utils.to_json(body)
|
||||
resp.status = falcon.HTTP_201
|
||||
|
||||
|
@ -82,6 +82,10 @@ class MessagesBaseTest(base.V1Base):
|
||||
expected_resources = [six.text_type(self.messages_path + '/' + id)
|
||||
for id in msg_ids]
|
||||
self.assertEqual(expected_resources, result_doc['resources'])
|
||||
|
||||
# NOTE(kgriffs): As of the Icehouse release, drivers are
|
||||
# required to either completely succeed, or completely fail
|
||||
# to enqueue the entire batch of messages.
|
||||
self.assertFalse(result_doc['partial'])
|
||||
|
||||
self.assertEqual(len(msg_ids), len(sample_messages))
|
||||
|
@ -84,7 +84,10 @@ class MessagesBaseTest(base.V1_1Base):
|
||||
expected_resources = [six.text_type(self.messages_path + '/' + id)
|
||||
for id in msg_ids]
|
||||
self.assertEqual(expected_resources, result_doc['resources'])
|
||||
self.assertFalse(result_doc['partial'])
|
||||
|
||||
# NOTE(kgriffs): As of v1.1, "partial" is no longer given
|
||||
# in the response document.
|
||||
self.assertNotIn('partial', result_doc)
|
||||
|
||||
self.assertEqual(len(msg_ids), len(sample_messages))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user