[PATCH] [Wok] Issue #41: encode of ident should only happen if it is of type unicode.

From: Archana Singh <archus@linux.vnet.ibm.com> Added isinstance unicode check of ident before encoding it. Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- src/wok/control/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wok/control/base.py b/src/wok/control/base.py index be2e35e..25f6522 100644 --- a/src/wok/control/base.py +++ b/src/wok/control/base.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Project Wok # @@ -69,7 +70,9 @@ class Resource(object): self.admin_methods = [] self.log_map = {} self.log_args = { - 'ident': self.ident.encode('utf-8') if self.ident else '', + 'ident': self.ident.encode('utf-8') + if isinstance(self.ident, unicode) + else self.ident if self.ident else '', } def _redirect(self, action_result, code=303): -- 2.5.0

Reviewed-By: Lucio Correia <luciojhc@linux.vnet.ibm.com> On 21-03-2016 19:58, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
Added isinstance unicode check of ident before encoding it.
Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- src/wok/control/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py index be2e35e..25f6522 100644 --- a/src/wok/control/base.py +++ b/src/wok/control/base.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Project Wok # @@ -69,7 +70,9 @@ class Resource(object): self.admin_methods = [] self.log_map = {} self.log_args = { - 'ident': self.ident.encode('utf-8') if self.ident else '', + 'ident': self.ident.encode('utf-8') + if isinstance(self.ident, unicode) + else self.ident if self.ident else '', }
def _redirect(self, action_result, code=303):
-- Lucio Correia Software Engineer IBM LTC Brazil

Reviewed-by: Chandra Shekhar Reddy Potula <chandra@linux.vnet.ibm.com> On 3/22/16 4:28 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@linux.vnet.ibm.com>
Added isinstance unicode check of ident before encoding it.
Signed-off-by: Archana Singh <archus@linux.vnet.ibm.com> --- src/wok/control/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/wok/control/base.py b/src/wok/control/base.py index be2e35e..25f6522 100644 --- a/src/wok/control/base.py +++ b/src/wok/control/base.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # Project Wok # @@ -69,7 +70,9 @@ class Resource(object): self.admin_methods = [] self.log_map = {} self.log_args = { - 'ident': self.ident.encode('utf-8') if self.ident else '', + 'ident': self.ident.encode('utf-8') + if isinstance(self.ident, unicode) + else self.ident if self.ident else '', }
def _redirect(self, action_result, code=303):
participants (4)
-
Aline Manera
-
archus@linux.vnet.ibm.com
-
Chandra Shekhar Reddy Potula
-
Lucio Correia