From 15629d15d816319ff4ed1badc4c3aa0dd0ce5991 Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Thu, 27 May 2010 10:49:48 -0700 Subject: [PATCH] Backed out changeset 4e67bcf6e46b It busted up installations that didn't have psycopg 2.2 --- eventlet/support/psycopg2_patcher.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/eventlet/support/psycopg2_patcher.py b/eventlet/support/psycopg2_patcher.py index 29af65d..7d9c1d5 100644 --- a/eventlet/support/psycopg2_patcher.py +++ b/eventlet/support/psycopg2_patcher.py @@ -38,20 +38,15 @@ def make_psycopg_green(): extensions.set_wait_callback(eventlet_wait_callback) -def eventlet_wait_callback(conn, timeout=-1, - # access these objects with LOAD_FAST instead of LOAD_GLOBAL lookup - POLL_OK=extensions.POLL_OK, - POLL_READ=extensions.POLL_READ, - POLL_WRITE=extensions.POLL_WRITE, - trampoline=trampoline): +def eventlet_wait_callback(conn, timeout=-1): """A wait callback useful to allow eventlet to work with Psycopg.""" while 1: state = conn.poll() - if state == POLL_OK: + if state == extensions.POLL_OK: break - elif state == POLL_READ: + elif state == extensions.POLL_READ: trampoline(conn.fileno(), read=True) - elif state == POLL_WRITE: + elif state == extensions.POLL_WRITE: trampoline(conn.fileno(), write=True) else: raise psycopg2.OperationalError(