diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2019-09-02 23:32:30 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2019-09-08 22:50:45 +0200 |
commit | 221ce5a2680c1a91b7b87a36d73be5c0ad7e5ddb (patch) | |
tree | 04caa19b6369862f9f25b601e8572be0b5c0e7f6 /utils/nslcd.py | |
parent | 06ee88605e176c77eda2dc0a5499e2baef65e8f1 (diff) |
Add Python 3 support
This ensures that both pynslcd and the command-line utilities work with
Python3 as interpreter and runs some tests with all installed Python
interpreters.
This drops support for Python 2.6 and extends 5a84be2 to perform more
testing with Python 3.
Diffstat (limited to 'utils/nslcd.py')
-rw-r--r-- | utils/nslcd.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/utils/nslcd.py b/utils/nslcd.py index bb720a3..82e5bbb 100644 --- a/utils/nslcd.py +++ b/utils/nslcd.py @@ -2,7 +2,7 @@ # nslcd.py - functions for doing nslcd requests # -# Copyright (C) 2013-2017 Arthur de Jong +# Copyright (C) 2013-2019 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -55,12 +55,13 @@ class NslcdClient(object): def write_bytes(self, value): self.write_int32(len(value)) - self.write(value) + if value: + self.write(value) def write_string(self, value): if sys.version_info[0] >= 3: value = value.encode('utf-8') - self.write_bytes(value.encode('utf-8')) + self.write_bytes(value) def write_ether(self, value): value = struct.pack('BBBBBB', *(int(x, 16) for x in value.split(':'))) |