From 6c9a2a3c52592e12d9cb0b312dbeee4311aa0c24 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 24 Dec 2007 13:04:13 -0600 Subject: r26586: Rename fetch to get for consistency with the Python dictionary interface. (This used to be commit fadab7c60bb6dc5746cb2ee16f9c86fa0e0cdf1a) --- source4/lib/tdb/python/tests/simple.py | 4 ++-- source4/lib/tdb/tdb.i | 7 ++++--- source4/lib/tdb/tdb.py | 8 ++++---- source4/lib/tdb/tdb_wrap.c | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'source4/lib') 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("