Okay, here is a simple python test script using the couchdbkit library
#!/usr/bin/env python
import couchdbkit from couchdbkit.designer import push import os
# Get the server server = couchdbkit.Server("http://127.0.0.1:5984")
# Get or create a database db = server.get_or_create_db('test')
# Prepare a simple view that will return whatever we have stored view = """ function(doc) { emit(doc._id, doc); } """
# Setup filesystem directory to store a "view all" javascript file, map.js cdb_design = "cdb/_design/test" cdb_view = os.path.join(cdb_design, "views/all") cdb_map = os.path.join(cdb_view, "map.js")
if not os.path.exists(cdb_view): os.makedirs(cdb_view) outfile = open(cdb_map, "w") outfile.write(view) outfile.close() # upload our map.js view to the database push(cdb_design, db)
# create a test document to store in the database doc = { 'Test' : 'Boo' }
# save it db.save_doc(doc)
# retrieve everything in our database results = db.view('test/all') for _doc in results: print _doc # delete the doc from the database print db.delete_doc(_doc.get('value'))
# create 1 more doc so it can be viewed via a web browser new_doc = {"works" : "Go to http://127.0.0.1:5984/_utils to view db"}
# save db.save_doc(new_doc)
# if all has gone well, fire up your browser and have a look around # here: http://127.0.0.1:5984/_utils
On Wed, Mar 14, 2012 at 7:27 PM, Michael Milverton m.milverton@gmail.comwrote:
Okay, will do it this weekend.
On 14/03/2012, at 17:08, Miroslav Grepl mgrepl@redhat.com wrote:
On 03/13/2012 02:39 PM, Michael Milverton wrote:
Thanks,
Do you want a small python test script? I used couchdbkit ( http://couchdbkit.org/)?
It would be great.
Maybe someone else has some simple test code lying around??
On Tue, Mar 13, 2012 at 10:20 PM, Daniel J Walsh dwalsh@redhat.comwrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Ok I was close. I am attaching the patch to show what I added based on your policy.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk9fV5MACgkQrlYvE4MpobPSwwCgr+YU1VPetGI51OehHt4A4VIT 8YkAn3Fh1GtxwIiNPqY4yI4qTFlkKgx0 =BB2R -----END PGP SIGNATURE-----
-- selinux mailing listselinux@lists.fedoraproject.orghttps://admin.fedoraproject.org/mailman/listinfo/selinux