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

jelmer at samba.org jelmer at samba.org
Mon Oct 15 13:29:09 GMT 2007


Author: jelmer
Date: 2007-10-15 13:29:08 +0000 (Mon, 15 Oct 2007)
New Revision: 25652

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

Log:
Support valid_attr_name.
Modified:
   branches/4.0-python/
   branches/4.0-python/source/lib/ldb/include/ldb.h
   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/include/ldb.h
===================================================================
--- branches/4.0-python/source/lib/ldb/include/ldb.h	2007-10-15 13:29:05 UTC (rev 25651)
+++ branches/4.0-python/source/lib/ldb/include/ldb.h	2007-10-15 13:29:08 UTC (rev 25652)
@@ -1217,7 +1217,7 @@
 
 /**
    Check the attribute name is valid according to rfc2251
-   \param s tthe string to check
+   \param s the string to check
 
    \return 1 if the name is ok
 */

Modified: branches/4.0-python/source/lib/ldb/swig/ldb.i
===================================================================
--- branches/4.0-python/source/lib/ldb/swig/ldb.i	2007-10-15 13:29:05 UTC (rev 25651)
+++ branches/4.0-python/source/lib/ldb/swig/ldb.i	2007-10-15 13:29:08 UTC (rev 25652)
@@ -54,10 +54,10 @@
 %include "typemaps.i"
 %include "exception.i"
 
-enum ldb_scope {LDB_SCOPE_DEFAULT=-1, 
-		LDB_SCOPE_BASE=0, 
-		LDB_SCOPE_ONELEVEL=1,
-		LDB_SCOPE_SUBTREE=2};
+%constant int SCOPE_DEFAULT = LDB_SCOPE_DEFAULT;
+%constant int SCOPE_BASE = LDB_SCOPE_BASE;
+%constant int SCOPE_ONELEVEL = LDB_SCOPE_ONELEVEL;
+%constant int SCOPE_SUBTREE = LDB_SCOPE_SUBTREE;
 
 /* 
  * Wrap struct ldb_context
@@ -322,4 +322,6 @@
 %nodefault Ldb;
 %nodefault Dn;
 
+%rename(valid_attr_name) ldb_valid_attr_name;
+int ldb_valid_attr_name(const char *s);
 

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 13:29:05 UTC (rev 25651)
+++ branches/4.0-python/source/lib/ldb/tests/python/api.py	2007-10-15 13:29:08 UTC (rev 25652)
@@ -8,6 +8,11 @@
 
 import ldb
 
+class NoContextTests(unittest.TestCase):
+    def test_valid_attr_name(self):
+        self.assertTrue(ldb.valid_attr_name("foo"))
+        self.assertFalse(ldb.valid_attr_name("24foo"))
+
 class SimpleLdb(unittest.TestCase):
     def test_connect(self):
         ldb.Ldb("foo.tdb")
@@ -26,7 +31,7 @@
     def test_search_scope_base(self):
         l = ldb.Ldb("foo.tdb")
         self.assertEquals(len(l.search(ldb.Dn(l, "dc=foo"), 
-                          ldb.LDB_SCOPE_ONELEVEL)), 0)
+                          ldb.SCOPE_ONELEVEL)), 0)
 
     def test_delete(self):
         l = ldb.Ldb("foo.tdb")



More information about the samba-cvs mailing list