diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-04-20 12:30:41 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-04-21 15:09:13 +0100 |
| commit | d8f4ed1a04411852b20aa2f2a4d0f1f1032aa8f0 (patch) | |
| tree | 52e8ad19058de7202f30fb20589cb231982ef3cc /examples | |
| parent | 6fecc36b7f8cabe70376efb2f4fcc7a45032f307 (diff) | |
| download | psycopg2-d8f4ed1a04411852b20aa2f2a4d0f1f1032aa8f0.tar.gz | |
Fixed documentation and example for asynchronous notifications.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/notify.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/notify.py b/examples/notify.py index 130ab1a..7dc15d2 100644 --- a/examples/notify.py +++ b/examples/notify.py @@ -36,8 +36,9 @@ curs.execute("listen test") print "Waiting for 'NOTIFY test'" while 1: - if select.select([curs.connection],[],[],5)==([],[],[]): + if select.select([conn],[],[],5)==([],[],[]): print "Timeout" else: - if not curs.connection.poll(): - print "Got NOTIFY: %s" % str(curs.connection.notifies.pop()) + conn.poll() + while conn.notifies: + print "Got NOTIFY:", conn.notifies.pop() |
