Author: jelmer Date: 2007-11-20 01:31:48 +0000 (Tue, 20 Nov 2007) New Revision: 26044
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26044 Log: Add ldb.Message.keys(). Modified: branches/4.0-python/ branches/4.0-python/source/BRANCH.TODO branches/4.0-python/source/lib/ldb/ldb.i branches/4.0-python/source/lib/ldb/tests/python/api.py Changeset: Property changes on: branches/4.0-python ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/4.0-python/source/BRANCH.TODO =================================================================== --- branches/4.0-python/source/BRANCH.TODO 2007-11-19 19:57:43 UTC (rev 26043) +++ branches/4.0-python/source/BRANCH.TODO 2007-11-20 01:31:48 UTC (rev 26044) @@ -1,5 +1,6 @@ - support kwargs (especially for constructors with a lot of arguments) - make sure exceptions are properly thrown everywhere - - Use LdbError, NtStatusError, WinError rather than RuntimeError + - Use NtStatusError, WinError rather than RuntimeError - fix web server - allow non-top-level modules in build system +- don't crash when trying to commit a transaction when there is no transaction open Modified: branches/4.0-python/source/lib/ldb/ldb.i =================================================================== --- branches/4.0-python/source/lib/ldb/ldb.i 2007-11-19 19:57:43 UTC (rev 26043) +++ branches/4.0-python/source/lib/ldb/ldb.i 2007-11-20 01:31:48 UTC (rev 26044) @@ -377,6 +377,11 @@ unsigned int __len__() { return $self->num_elements; } + PyObject *keys(void) + { + return ldb_msg_list_elements($self); + } + PyObject *__iter__(void) { return PyObject_GetIter(ldb_msg_list_elements($self)); @@ -444,6 +449,10 @@ PyDict_SetItemString(d, "LdbError", PyExc_LdbError); %} +%ignore _LDB_ERRORS_H_; +%ignore LDB_SUCCESS; +%include "include/ldb_errors.h" + /* * Wrap ldb functions */ Modified: branches/4.0-python/source/lib/ldb/tests/python/api.py =================================================================== --- branches/4.0-python/source/lib/ldb/tests/python/api.py 2007-11-19 19:57:43 UTC (rev 26043) +++ branches/4.0-python/source/lib/ldb/tests/python/api.py 2007-11-20 01:31:48 UTC (rev 26044) @@ -324,6 +324,11 @@ self.msg["foo"] = ["bar"] self.assertEquals(["bar"], list(self.msg["foo"])) + def test_keys(self): + self.msg["foo"] = ["bla"] + self.msg["bar"] = ["bla"] + self.assertEquals(["foo", "bar"], self.msg.keys()) + def test_dn(self): self.msg.dn = ldb.Dn(ldb.Ldb("foo.tdb"), "@BASEINFO") self.assertEquals("@BASEINFO", self.msg.dn.__str__())
