I'm trying to use couchdb.py to create and update databases. I'd like to implement notification changes, preferably in continuous mode. Running the test code posted below, I don't see how the changes scheme works within python.

class SomeDocument(Document):

#############################################################################

#    def __init__ (self):

    intField  = IntegerField()#for now - this should to be an integer
    textField = TextField()

couch = couchdb.Server('http://127.0.0.1:5984')
databasename = 'testnotifications'

if databasename in couch:
    print 'Deleting then creating database ' + databasename + ' from server'
    del couch[databasename]
    db = couch.create(databasename)
else:
    print 'Creating database ' + databasename + ' on server'
    db = couch.create(databasename)

for iii in range(5):

    doc = SomeDocument(intField=iii,textField='somestring'+str(iii))
    doc.store(db)
    print doc.id + '\t' + doc.rev

something = db.changes(feed='continuous',since=4,heartbeat=1000)

for iii in range(5,10):

    doc = SomeDocument(intField=iii,textField='somestring'+str(iii))
    doc.store(db)
    time.sleep(1)
    print something
    print db.changes(since=iii-1)

The value

db.changes(since=iii-1) 

returns information that is of interest, but in a format from which I haven't worked out how to extract the sequence or revision numbers, or the document information:

{u'last_seq': 6, u'results': [{u'changes': [{u'rev': u'1-9c1e4df5ceacada059512a8180ead70e'}], u'id': u'7d0cb1ccbfd9675b4b6c1076f40049a8', u'seq': 5}, {u'changes': [{u'rev': u'1-bbe2953a5ef9835a0f8d548fa4c33b42'}], u'id': u'7d0cb1ccbfd9675b4b6c1076f400560d', u'seq': 6}]}

Meanwhile, the code I'm really interested in using:

db.changes(feed='continuous',since=4,heartbeat=1000)

Returns a generator object and doesn't appear to provide notificatio

Edit
Report