Py3: We cannot use len(filter(...))

In Python 3, filter() returns a filter object, that has no length.

Change-Id: I726188a328119f41c534a6232a4494e40815e05c
This commit is contained in:
Cyril Roelandt 2018-12-01 19:03:14 +01:00
parent 9017db4519
commit d75d15be7c

View File

@ -147,8 +147,7 @@ class FakeSwift(object):
def register(self, method, path, response_class, headers, body):
# assuming the path format like /v1/account/container/object
resource_map = ['account', 'container', 'object']
acos = filter(None, split_path(path, 0, 4, True)[1:])
index = len(acos) - 1
index = len(list(filter(None, split_path(path, 0, 4, True)[1:]))) - 1
resource = resource_map[index]
if (method, path) in self._responses:
old_headers = self._responses[(method, path)][1]