From: Archana Singh <archus(a)linux.vnet.ibm.com>
As ident is in encoded value but e.message is in unicode value,
combination of which result into unicode value having encoded ident value.
So when wok_log.error try to encode(encoded value) it result into error.
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
---
src/wok/control/base.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py
index be5f618..4b459ed 100644
--- a/src/wok/control/base.py
+++ b/src/wok/control/base.py
@@ -35,7 +35,7 @@ from wok.exception import MissingParameter, NotFoundError
from wok.exception import OperationFailed, UnauthorizedError, WokException
from wok.message import WokMessage
from wok.reqlogger import RequestRecord
-from wok.utils import get_plugin_from_request, utf8_dict, wok_log
+from wok.utils import get_plugin_from_request, utf8_dict, wok_log, encode_value
# Default request log messages
@@ -374,8 +374,14 @@ class Collection(object):
except Exception as e:
# In case of errors when fetching a resource info, pass and
# log the error, so, other resources are returned
+ # log the error, so, other resources are returned.
+ # Encoding error message as ident is also encoded value.
+ # This has to be done to avoid unicode error,
+ # as combination of encoded and unicode value results into
+ # unicode error.
wok_log.error("Problem in lookup of resource '%s'.
"
- "Detail: %s" % (ident, e.message))
+ "Detail: %s" % (ident,
+ encode_value(e.message)))
continue
res_list.append(res)
return res_list
--
2.5.0