pyldb: Split text/byte strings for compatibility with Python 3
authorPetr Viktorin <pviktori@redhat.com>
Tue, 9 Jun 2015 15:44:40 +0000 (17:44 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 5 Nov 2015 17:04:24 +0000 (18:04 +0100)
commitd584d5ee2af98cb4874d1a91e3bc092c5941d34b
tree580b66fee20566a4da1ad3bed3d56a9a009e222f
parent0b384f60ddc0d1844f5953a974eb9266ebbdd7bb
pyldb: Split text/byte strings for compatibility with Python 3

Compatibility with Python 2, and backwards compatibility on Python 2,
is kept.

Under Python 3, DNs, attribute names, filters, controls are always text
(unicode) strings, encoded to/from UTF-8 for storage.
Attribute values are byte strings.

When creating DNs and attribute values, both text and bytes are accepted.
This allows creating messages from homogeneous dicts.

LDB Messages and MessageElements have a .text attribute, which offers
a text view on the contents: any value retrieved from it will be a text
string. The wrapper is implemented in a new Python module.

Thanks to Stefan Metzmacher for const warning fixes

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/_ldb_text.py [new file with mode: 0644]
lib/ldb/pyldb.c
lib/ldb/pyldb_util.c
lib/ldb/wscript