svn commit: samba r25655 - in branches/4.0-python: . source/lib/ldb/swig source/lib/ldb/tests/python

jelmer at samba.org jelmer at samba.org
Mon Oct 15 20:18:48 GMT 2007


Author: jelmer
Date: 2007-10-15 20:18:47 +0000 (Mon, 15 Oct 2007)
New Revision: 25655

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25655

Log:
Add parse_ldif function.
Modified:
   branches/4.0-python/
   branches/4.0-python/source/lib/ldb/swig/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/lib/ldb/swig/ldb.i
===================================================================
--- branches/4.0-python/source/lib/ldb/swig/ldb.i	2007-10-15 20:18:38 UTC (rev 25654)
+++ branches/4.0-python/source/lib/ldb/swig/ldb.i	2007-10-15 20:18:47 UTC (rev 25655)
@@ -259,12 +259,6 @@
         unsigned int __len__() { return $self->num_elements; }
 #endif
         void remove_attr(const char *name);
-        ldb_msg *parse_ldif(const char *s)
-        {
-            struct ldb_ldif *ret = ldb_ldif_read_string($self, &s);
-
-            return ret->msg;
-        }
     }
 } ldb_msg;
 
@@ -339,6 +333,12 @@
             return result->count > 0;
         }
 #endif
+       ldb_msg *parse_ldif(const char *s)
+        {
+            struct ldb_ldif *ret = ldb_ldif_read_string($self, &s);
+
+            return ret->msg;
+        }
     }
 } ldb;
 

Modified: branches/4.0-python/source/lib/ldb/tests/python/api.py
===================================================================
--- branches/4.0-python/source/lib/ldb/tests/python/api.py	2007-10-15 20:18:38 UTC (rev 25654)
+++ branches/4.0-python/source/lib/ldb/tests/python/api.py	2007-10-15 20:18:47 UTC (rev 25655)
@@ -175,7 +175,9 @@
         self.assertEquals("dc=foo,bar=bla", str(y + x))
 
     def test_parse_ldif(self):
-        self.assertIsInstance(ldb.Message, ldb.parse_ldif("dn: foo=bar\n"))
+        msg = self.ldb.parse_ldif("dn: foo=bar\n")
+        self.assertEquals("foo=bar", str(msg.dn))
+        self.assertTrue(isinstance(msg, ldb.Message))
 
     def test_canonical_string(self):
         x = ldb.Dn(self.ldb, "dc=foo,bar=bloe")



More information about the samba-cvs mailing list