From 1bd337bd08c4b7bd88fcb69429e588b33409d680 Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Sun, 18 Oct 2015 16:03:08 -0400 Subject: [PATCH] validate non-ascii values for swift properties skip properties that are non-ascii values, but proceed with properties that work. log these failed values back to the user. Change-Id: Iaca8909f4465a01c8aebfd290b1a322823702359 Closes-Bug: 1503898 --- openstackclient/common/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openstackclient/common/utils.py b/openstackclient/common/utils.py index 51e2a2f9..8db4f35b 100644 --- a/openstackclient/common/utils.py +++ b/openstackclient/common/utils.py @@ -419,3 +419,11 @@ def build_kwargs_dict(arg_name, value): if value: kwargs[arg_name] = value return kwargs + + +def is_ascii(string): + try: + string.decode('ascii') + return True + except UnicodeDecodeError: + return False