From 93b5edddcec8180261178d898ae63e8262767d7c Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 25 Mar 2010 14:04:46 +0000 Subject: [PATCH] [1.1.X] Fixed #12766 -- Only set the psycopg1 client encoding when the connection is first created. This allows the custom_pk test to pass under psycopg1. Backport of r12848 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12849 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/postgresql/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index 77f7c38a6f..7ab2da2184 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -127,9 +127,8 @@ class DatabaseWrapper(BaseDatabaseWrapper): if self._version[0:2] < (8, 0): # No savepoint support for earlier version of PostgreSQL. self.features.uses_savepoints = False - cursor.execute("SET client_encoding to 'UNICODE'") - cursor = UnicodeCursorWrapper(cursor, 'utf-8') - return cursor + cursor.execute("SET client_encoding to 'UNICODE'") + return UnicodeCursorWrapper(cursor, 'utf-8') def typecast_string(s): """