diff options
author | Juan Antonio Osorio Robles <juan.osorio.robles@ericsson.com> | 2015-03-03 14:30:41 +0200 |
---|---|---|
committer | Juan Antonio Osorio Robles <juan.osorio.robles@ericsson.com> | 2015-03-03 14:30:41 +0200 |
commit | 8c9024337c67f2dbf1a851f12209cb6bdf6f1e7c (patch) | |
tree | d2c5062b52ece176dc2347ecda8d1a1f6566090b | |
parent | 347d034d4688a8949781303eae5534252840c779 (diff) | |
download | python-barbicanclient-8c9024337c67f2dbf1a851f12209cb6bdf6f1e7c.tar.gz |
Do not filter empty strings
Empty strings shouldn't be filtered from requests, as we have
explicitly set some attributes to be optional and actually
differentiate between null and empty attributes in the server side. So
now, only attributes containing None are filtered and empty strings
are actually passed to the server.
Change-Id: Ia048d7de6bcbc12317930eeccc009b6b0db10e13
Closes-bug: #1420445
-rw-r--r-- | barbicanclient/base.py | 4 | ||||
-rw-r--r-- | barbicanclient/containers.py | 2 | ||||
-rw-r--r-- | barbicanclient/orders.py | 2 | ||||
-rw-r--r-- | barbicanclient/secrets.py | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/barbicanclient/base.py b/barbicanclient/base.py index e8de75e..c335093 100644 --- a/barbicanclient/base.py +++ b/barbicanclient/base.py @@ -20,8 +20,8 @@ import uuid import six -def filter_empty_keys(dictionary): - return dict(((k, v) for k, v in dictionary.items() if v)) +def filter_null_keys(dictionary): + return dict(((k, v) for k, v in dictionary.items() if v is not None)) def validate_ref(ref, entity): diff --git a/barbicanclient/containers.py b/barbicanclient/containers.py index 6fc0b97..686ad45 100644 --- a/barbicanclient/containers.py +++ b/barbicanclient/containers.py @@ -182,7 +182,7 @@ class Container(ContainerFormatter): """Store Container in Barbican""" secret_refs = self._get_secrets_and_store_them_if_necessary() - container_dict = base.filter_empty_keys({ + container_dict = base.filter_null_keys({ 'name': self.name, 'type': self._type, 'secret_refs': secret_refs diff --git a/barbicanclient/orders.py b/barbicanclient/orders.py index b5d01c5..49c6de4 100644 --- a/barbicanclient/orders.py +++ b/barbicanclient/orders.py @@ -108,7 +108,7 @@ class Order(object): self._order_ref = order_ref - self._meta = base.filter_empty_keys(meta) + self._meta = base.filter_null_keys(meta) self._error_status_code = error_status_code self._error_reason = error_reason diff --git a/barbicanclient/secrets.py b/barbicanclient/secrets.py index f6f9c58..7d87376 100644 --- a/barbicanclient/secrets.py +++ b/barbicanclient/secrets.py @@ -232,7 +232,7 @@ class Secret(SecretFormatter): Stores the Secret in Barbican. New Secret objects are not persisted in Barbican until this method is called. """ - secret_dict = base.filter_empty_keys({ + secret_dict = base.filter_null_keys({ 'name': self.name, 'payload': self.payload, 'payload_content_type': self.payload_content_type, |