diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-01-10 21:44:38 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-01-10 23:41:14 +0100 |
commit | 6bdd1425b75c8931965f0e5627f5a63dc6820a7c (patch) | |
tree | e1a7f29ab07d1a4b60fd8ac113fc0bada5ac1ddc /source4/lib/tdb/python/tdbdump.py | |
parent | 80902a2a2b14bc27af0f195d18c40ccef9cb780c (diff) | |
download | samba-6bdd1425b75c8931965f0e5627f5a63dc6820a7c.tar.gz samba-6bdd1425b75c8931965f0e5627f5a63dc6820a7c.tar.bz2 samba-6bdd1425b75c8931965f0e5627f5a63dc6820a7c.zip |
tdb: Add simple reimplementation of tdbdump in Python as an example of the tdb Python bindings.
(This used to be commit 47d797f7885b1e7bcff724496ecb1990e8440eea)
Diffstat (limited to 'source4/lib/tdb/python/tdbdump.py')
-rw-r--r-- | source4/lib/tdb/python/tdbdump.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/lib/tdb/python/tdbdump.py b/source4/lib/tdb/python/tdbdump.py new file mode 100644 index 0000000000..d759d771c8 --- /dev/null +++ b/source4/lib/tdb/python/tdbdump.py @@ -0,0 +1,12 @@ +#!/usr/bin/python +# Trivial reimplementation of tdbdump in Python + +import tdb, sys + +if len(sys.argv) < 2: + print "Usage: tdbdump.py <tdb-file>" + sys.exit(1) + +db = tdb.Tdb(sys.argv[1]) +for (k, v) in db.iteritems(): + print "{\nkey(%d) = %r\ndata(%d) = %r\n}" % (len(k), k, len(v), v) |