diff options
| author | Jan UrbaĆski <wulczer@wulczer.org> | 2010-03-31 01:43:07 +0200 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2010-04-05 11:41:32 +0200 |
| commit | 01799e9137077e56220425faa245fdf5ac3a30e9 (patch) | |
| tree | f9d0d43fe53347f617f1769447094160e0df3741 /lib/extras.py | |
| parent | d8ab5ac8a1f15d9f3e33ac54942b04bb52ca161f (diff) | |
| download | psycopg2-01799e9137077e56220425faa245fdf5ac3a30e9.tar.gz | |
Make asynchronous connections produce asynchronous cursors by default
Drop the async kwarg from cursor.execute(), cursors created by
asynchronous connections will be asynchronous by default, ones created
by synchronous connections will be synchronous.
Mind that this might break third party subclasses of
psycopg2.extensions.cursor, if they try to chain to the superclass in
their execute() implementation and are passing the async kwarg. The
example cursors in psycopg2.extras have been fixed no to do that.
Diffstat (limited to 'lib/extras.py')
| -rw-r--r-- | lib/extras.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/extras.py b/lib/extras.py index 87c9f7c..027c587 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -112,10 +112,10 @@ class DictCursor(DictCursorBase): DictCursorBase.__init__(self, *args, **kwargs) self._prefetch = 1 - def execute(self, query, vars=None, async=0): + def execute(self, query, vars=None): self.index = {} self._query_executed = 1 - return _cursor.execute(self, query, vars, async) + return _cursor.execute(self, query, vars) def callproc(self, procname, vars=None): self.index = {} @@ -201,10 +201,10 @@ class RealDictCursor(DictCursorBase): DictCursorBase.__init__(self, *args, **kwargs) self._prefetch = 0 - def execute(self, query, vars=None, async=0): + def execute(self, query, vars=None): self.column_mapping = [] self._query_executed = 1 - return _cursor.execute(self, query, vars, async) + return _cursor.execute(self, query, vars) def callproc(self, procname, vars=None): self.column_mapping = [] @@ -282,9 +282,9 @@ class LoggingConnection(_connection): class LoggingCursor(_cursor): """A cursor that logs queries using its connection logging facilities.""" - def execute(self, query, vars=None, async=0): + def execute(self, query, vars=None): try: - return _cursor.execute(self, query, vars, async) + return _cursor.execute(self, query, vars) finally: self.connection.log(self.query, self) @@ -325,9 +325,9 @@ class MinTimeLoggingConnection(LoggingConnection): class MinTimeLoggingCursor(LoggingCursor): """The cursor sub-class companion to `MinTimeLoggingConnection`.""" - def execute(self, query, vars=None, async=0): + def execute(self, query, vars=None): self.timestamp = time.time() - return LoggingCursor.execute(self, query, vars, async) + return LoggingCursor.execute(self, query, vars) def callproc(self, procname, vars=None): self.timestamp = time.time() |
