mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
7b170206b4
ldb attributes are either bytes (py3) or str (py2) Some places in the code do str(res[0]['attribute'][0]) which results in 'result' (py2) b'result' (py3) or more commonly the attribute is used to construct a string e.g. "blah=" + res[0]['attribute'][0] + ",foo,bar=...." giving "blah=result,foo,bar=...." (py2) and very unhelpfully "blah=b'result',foo,bar=...." (py3) lots of code already constructs various strings for passing to other api using the above. To avoid many excessive res[0]['attribute'][0].decode('utf8') code like 'res[0]['attribute'][0]' will now return LdbBytes (a new object subclassing 'bytes') in py3 instead of bytes. This object has a custom '__str__' method which attempts to return a string decoded to uft8. In Py2 this will behave as it did previously (this is the safer option at the moment) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> |
||
---|---|---|
.. | ||
ABI | ||
common | ||
docs | ||
examples | ||
include | ||
ldb_ldap | ||
ldb_ldb | ||
ldb_map | ||
ldb_mdb | ||
ldb_sqlite3 | ||
ldb_tdb | ||
man | ||
modules | ||
nssldb | ||
tests | ||
tools | ||
web | ||
_ldb_text.py | ||
configure | ||
Doxyfile | ||
examples.dox | ||
ldb.pc.in | ||
mainpage.dox | ||
Makefile | ||
pyldb_util.c | ||
pyldb-util.pc.in | ||
pyldb.c | ||
pyldb.h | ||
README_gcov.txt | ||
wscript |