From 4c63aa4a61c2c081ff8860c8419f2087ee017032 Mon Sep 17 00:00:00 2001 From: Ilias Stamatis Date: Sun, 13 Aug 2017 22:13:29 +0300 Subject: [PATCH] Issue 92 - display_attr() should return str not bytes in py3 Bug Description: display_attr method of mapped object returns bytes in python3. Since we use this function to display display data to the end user we don't want this. There is also a bug in get_attr_vals_type() methods. These methods call a non-existing function due to a typo. Fix Description: Call get_attr_valus_utf8 instead of get_attr_vals from within display_attr method. Also fix the bug with the get_attr_vals_type by correcting the method's name. https://pagure.io/lib389/issue/92 Author: Ilias95 Review by: ??? --- lib389/_mapped_object.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib389/_mapped_object.py b/lib389/_mapped_object.py index c98f1bc..17222e4 100644 --- a/lib389/_mapped_object.py +++ b/lib389/_mapped_object.py @@ -127,7 +127,7 @@ class DSLdapObject(DSLogging): def display_attr(self, attr): out = "" - for v in self.get_attr_vals(attr): + for v in self.get_attr_vals_utf8(attr): out += "%s: %s\n" % (attr, v) return out @@ -349,19 +349,19 @@ class DSLdapObject(DSLogging): return ensure_bytes(self.get_attr_val(key)) def get_attr_vals_bytes(self, key): - return ensure_list_bytes(self.get_attrs_val(key)) + return ensure_list_bytes(self.get_attr_vals(key)) def get_attr_val_utf8(self, key): return ensure_str(self.get_attr_val(key)) def get_attr_vals_utf8(self, key): - return ensure_list_str(self.get_attrs_val(key)) + return ensure_list_str(self.get_attr_vals(key)) def get_attr_val_int(self, key): return ensure_int(self.get_attr_val(key)) def get_attr_vals_int(self, key): - return ensure_list_int(self.get_attrs_val(key)) + return ensure_list_int(self.get_attr_vals(key)) # Duplicate, but with many values. IE a dict api. # This -- 2.13.4