diff options
author | Noel Power <noel.power@suse.com> | 2018-03-22 12:35:11 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-04-05 08:59:08 +0200 |
commit | 1734655bf805342ce4b2a33c78729b681846da52 (patch) | |
tree | 7ab754125ee863274e8646b09e15d876113b4873 /python/samba/samba3 | |
parent | 8caa2cd48a8ad4ce6aeeb16e48a2382f913e073b (diff) | |
download | samba-1734655bf805342ce4b2a33c78729b681846da52.tar.gz |
python selftest: enabled samba.tests.s3registry to run with py3
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python/samba/samba3')
-rw-r--r-- | python/samba/samba3/__init__.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/python/samba/samba3/__init__.py b/python/samba/samba3/__init__.py index ff28da49881..323953857d5 100644 --- a/python/samba/samba3/__init__.py +++ b/python/samba/samba3/__init__.py @@ -19,7 +19,7 @@ __docformat__ = "restructuredText" -REGISTRY_VALUE_PREFIX = "SAMBA_REGVAL" +REGISTRY_VALUE_PREFIX = b"SAMBA_REGVAL" REGISTRY_DB_VERSION = 1 import os @@ -79,7 +79,7 @@ class Registry(DbDatabase): def keys(self): """Return list with all the keys.""" - return [k.rstrip("\x00") for k in self.db.iterkeys() if not k.startswith(REGISTRY_VALUE_PREFIX)] + return [k.rstrip(b"\x00") for k in self.db if not k.startswith(REGISTRY_VALUE_PREFIX)] def subkeys(self, key): """Retrieve the subkeys for the specified key. @@ -87,12 +87,12 @@ class Registry(DbDatabase): :param key: Key path. :return: list with key names """ - data = self.db.get("%s\x00" % key) + data = self.db.get(b"%s\x00" % key) if data is None: return [] (num, ) = struct.unpack("<L", data[0:4]) - keys = data[4:].split("\0") - assert keys[-1] == "" + keys = data[4:].split(b"\0") + assert keys[-1] == b"" keys.pop() assert len(keys) == num return keys @@ -103,7 +103,7 @@ class Registry(DbDatabase): :param key: Key to retrieve values for. :return: Dictionary with value names as key, tuple with type and data as value.""" - data = self.db.get("%s/%s\x00" % (REGISTRY_VALUE_PREFIX, key)) + data = self.db.get(b"%s/%s\x00" % (REGISTRY_VALUE_PREFIX, key)) if data is None: return {} ret = {} @@ -111,7 +111,7 @@ class Registry(DbDatabase): data = data[4:] for i in range(num): # Value name - (name, data) = data.split("\0", 1) + (name, data) = data.split(b"\0", 1) (type, ) = struct.unpack("<L", data[0:4]) data = data[4:] |