diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-24 13:04:13 -0600 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-26 11:57:04 -0600 |
commit | 6c9a2a3c52592e12d9cb0b312dbeee4311aa0c24 (patch) | |
tree | 6246085f09a047d8df872d2d53aa4e037480afa0 /source4/lib/tdb | |
parent | 59efa6e5d074f9f0fbc0b5fd2b5bcdc9d78b95e3 (diff) | |
download | samba-6c9a2a3c52592e12d9cb0b312dbeee4311aa0c24.tar.gz samba-6c9a2a3c52592e12d9cb0b312dbeee4311aa0c24.tar.bz2 samba-6c9a2a3c52592e12d9cb0b312dbeee4311aa0c24.zip |
r26586: Rename fetch to get for consistency with the Python dictionary interface.
(This used to be commit fadab7c60bb6dc5746cb2ee16f9c86fa0e0cdf1a)
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r-- | source4/lib/tdb/python/tests/simple.py | 4 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.i | 7 | ||||
-rw-r--r-- | source4/lib/tdb/tdb.py | 8 | ||||
-rw-r--r-- | source4/lib/tdb/tdb_wrap.c | 8 |
4 files changed, 14 insertions, 13 deletions
diff --git a/source4/lib/tdb/python/tests/simple.py b/source4/lib/tdb/python/tests/simple.py index 0e0ef0251e..698a77f942 100644 --- a/source4/lib/tdb/python/tests/simple.py +++ b/source4/lib/tdb/python/tests/simple.py @@ -44,9 +44,9 @@ class SimpleTdbTests(TestCase): def test_store(self): self.tdb.store("bar", "bla") - self.assertEquals("bla", self.tdb.fetch("bar")) + self.assertEquals("bla", self.tdb.get("bar")) - def test_fetch(self): + def test_getitem(self): self.tdb["bar"] = "foo" self.tdb.reopen() self.assertEquals("foo", self.tdb["bar"]) diff --git a/source4/lib/tdb/tdb.i b/source4/lib/tdb/tdb.i index 933bfc7bb7..1b4742a477 100644 --- a/source4/lib/tdb/tdb.i +++ b/source4/lib/tdb/tdb.i @@ -158,6 +158,7 @@ typedef struct tdb_context { int close(); int append(TDB_DATA key, TDB_DATA new_dbuf); const char *errorstr(); + %rename(get) fetch; TDB_DATA fetch(TDB_DATA key); int delete(TDB_DATA key); int store(TDB_DATA key, TDB_DATA dbuf, int flag); @@ -186,7 +187,7 @@ typedef struct tdb_context { # Random access to keys, values def __getitem__(self, key): - result = self.fetch(key) + result = self.get(key) if result is None: raise KeyError, '%s: %s' % (key, self.errorstr()) return result @@ -207,14 +208,14 @@ typedef struct tdb_context { return self.exists(key) != 0 def fetch_uint32(self, key): - data = self.fetch(key) + data = self.get(key) if data is None: return None import struct return struct.unpack("<L", data)[0] def fetch_int32(self, key): - data = self.fetch(key) + data = self.get(key) if data is None: return None import struct diff --git a/source4/lib/tdb/tdb.py b/source4/lib/tdb/tdb.py index 8566397ed3..f5c21e4391 100644 --- a/source4/lib/tdb/tdb.py +++ b/source4/lib/tdb/tdb.py @@ -88,7 +88,7 @@ class tdb(object): def __getitem__(self, key): - result = self.fetch(key) + result = self.get(key) if result is None: raise KeyError, '%s: %s' % (key, self.errorstr()) return result @@ -109,14 +109,14 @@ class tdb(object): return self.exists(key) != 0 def fetch_uint32(self, key): - data = self.fetch(key) + data = self.get(key) if data is None: return None import struct return struct.unpack("<L", data)[0] def fetch_int32(self, key): - data = self.fetch(key) + data = self.get(key) if data is None: return None import struct @@ -172,7 +172,7 @@ tdb.error = new_instancemethod(_tdb.tdb_error,None,tdb) tdb.close = new_instancemethod(_tdb.tdb_close,None,tdb) tdb.append = new_instancemethod(_tdb.tdb_append,None,tdb) tdb.errorstr = new_instancemethod(_tdb.tdb_errorstr,None,tdb) -tdb.fetch = new_instancemethod(_tdb.tdb_fetch,None,tdb) +tdb.get = new_instancemethod(_tdb.tdb_get,None,tdb) tdb.delete = new_instancemethod(_tdb.tdb_delete,None,tdb) tdb.store = new_instancemethod(_tdb.tdb_store,None,tdb) tdb.exists = new_instancemethod(_tdb.tdb_exists,None,tdb) diff --git a/source4/lib/tdb/tdb_wrap.c b/source4/lib/tdb/tdb_wrap.c index c6dc337f63..e8c8c89f94 100644 --- a/source4/lib/tdb/tdb_wrap.c +++ b/source4/lib/tdb/tdb_wrap.c @@ -3014,7 +3014,7 @@ fail: } -SWIGINTERN PyObject *_wrap_tdb_fetch(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { +SWIGINTERN PyObject *_wrap_tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; tdb *arg1 = (tdb *) 0 ; TDB_DATA arg2 ; @@ -3027,10 +3027,10 @@ SWIGINTERN PyObject *_wrap_tdb_fetch(PyObject *SWIGUNUSEDPARM(self), PyObject *a (char *) "self",(char *) "key", NULL }; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_fetch",kwnames,&obj0,&obj1)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:tdb_get",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_fetch" "', argument " "1"" of type '" "tdb *""'"); + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_get" "', argument " "1"" of type '" "tdb *""'"); } arg1 = (tdb *)(argp1); if (obj1 == Py_None) { @@ -3607,7 +3607,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"tdb_close", (PyCFunction)_wrap_tdb_close, METH_O, NULL}, { (char *)"tdb_append", (PyCFunction) _wrap_tdb_append, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"tdb_errorstr", (PyCFunction)_wrap_tdb_errorstr, METH_O, NULL}, - { (char *)"tdb_fetch", (PyCFunction) _wrap_tdb_fetch, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"tdb_get", (PyCFunction) _wrap_tdb_get, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"tdb_delete", (PyCFunction) _wrap_tdb_delete, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"tdb_store", (PyCFunction) _wrap_tdb_store, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"tdb_exists", (PyCFunction) _wrap_tdb_exists, METH_VARARGS | METH_KEYWORDS, NULL}, |