logo       

notify.py: msg#00077

python.db.psycopg.devel

Subject: notify.py

I'm trying to refactor some of my code to use the "new" method of doing a LISTEN on the database, I'm stuck on this key piece of code:

print "Waiting for 'NOTIFY test'"
while 1:
if select.select([curs],[],[],5)==([],[],[]):
print "Timeout"
else:
if curs.isready():
print "Got NOTIFY: %s" % str(curs.connection.notifies.pop())


I understand the 'select' part.

What does curs.isready() do? What happens if it comes back as not True?

Also, I presume the '.pop()' ought to be called repeatedly until there are no more? How does one know that?

Does this all replace the previous way of doing things that looked something like this?

n = curs.notifies()[0][0] # Get the notification

Any help/explanation appreciated.

Thanks,
Michael


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise