Author: jelmer Date: 2007-12-24 13:04:13 +0000 (Mon, 24 Dec 2007) New Revision: 26586
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26586 Log: Rename fetch to get for consistency with the Python dictionary interface. Modified: branches/SAMBA_4_0/ branches/SAMBA_4_0/source/lib/tdb/python/tests/simple.py branches/SAMBA_4_0/source/lib/tdb/tdb.i branches/SAMBA_4_0/source/lib/tdb/tdb.py branches/SAMBA_4_0/source/lib/tdb/tdb_wrap.c Changeset: Property changes on: branches/SAMBA_4_0 ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/SAMBA_4_0/source/lib/tdb/python/tests/simple.py =================================================================== --- branches/SAMBA_4_0/source/lib/tdb/python/tests/simple.py 2007-12-24 11:02:52 UTC (rev 26585) +++ branches/SAMBA_4_0/source/lib/tdb/python/tests/simple.py 2007-12-24 13:04:13 UTC (rev 26586) @@ -44,9 +44,9 @@ 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"]) Modified: branches/SAMBA_4_0/source/lib/tdb/tdb.i =================================================================== --- branches/SAMBA_4_0/source/lib/tdb/tdb.i 2007-12-24 11:02:52 UTC (rev 26585) +++ branches/SAMBA_4_0/source/lib/tdb/tdb.i 2007-12-24 13:04:13 UTC (rev 26586) @@ -158,6 +158,7 @@ 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 @@ # 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 @@ 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 Modified: branches/SAMBA_4_0/source/lib/tdb/tdb.py =================================================================== --- branches/SAMBA_4_0/source/lib/tdb/tdb.py 2007-12-24 11:02:52 UTC (rev 26585) +++ branches/SAMBA_4_0/source/lib/tdb/tdb.py 2007-12-24 13:04:13 UTC (rev 26586) @@ -88,7 +88,7 @@ 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 @@ 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.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) Modified: branches/SAMBA_4_0/source/lib/tdb/tdb_wrap.c =================================================================== --- branches/SAMBA_4_0/source/lib/tdb/tdb_wrap.c 2007-12-24 11:02:52 UTC (rev 26585) +++ branches/SAMBA_4_0/source/lib/tdb/tdb_wrap.c 2007-12-24 13:04:13 UTC (rev 26586) @@ -3014,7 +3014,7 @@ } -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 @@ (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 @@ { (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},
