From 5d692deb7f188735ceadee1e5b8fb8360c621901 Mon Sep 17 00:00:00 2001 From: Alexey Ovchinnikov Date: Wed, 23 Nov 2016 13:40:29 +0300 Subject: [PATCH] Minor refactoring for nested try-block A minor refactoring for unnecessary try-block nesting. TrivialFix Change-Id: I8bfb2ff10f802594769a53c9c90a47ae21af1f22 --- cinderclient/apiclient/base.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cinderclient/apiclient/base.py b/cinderclient/apiclient/base.py index ef7e258ba..eec919e2e 100644 --- a/cinderclient/apiclient/base.py +++ b/cinderclient/apiclient/base.py @@ -491,14 +491,13 @@ class Resource(RequestIdMixin): def _add_details(self, info): for (k, v) in six.iteritems(info): try: - try: - setattr(self, k, v) - except UnicodeEncodeError: - pass - self._info[k] = v + setattr(self, k, v) except AttributeError: # In this case we already defined the attribute on the class + continue + except UnicodeEncodeError: pass + self._info[k] = v def __getattr__(self, k): if k not in self.__dict__ or k not in self._info: