Ticket #13161: patch-r12807.diff
File patch-r12807.diff, 1.6 KB (added by , 15 years ago) |
---|
-
base.py
26 26 DatabaseError = Database.DatabaseError 27 27 IntegrityError = Database.IntegrityError 28 28 29 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)30 29 psycopg2.extensions.register_adapter(SafeString, psycopg2.extensions.QuotedString) 31 30 psycopg2.extensions.register_adapter(SafeUnicode, psycopg2.extensions.QuotedString) 32 31 … … 98 97 99 98 def __init__(self, *args, **kwargs): 100 99 super(DatabaseWrapper, self).__init__(*args, **kwargs) 101 100 self._set_extension() 102 101 self.features = DatabaseFeatures() 103 102 autocommit = self.settings_dict["OPTIONS"].get('autocommit', False) 104 103 self.features.uses_autocommit = autocommit … … 108 107 self.creation = DatabaseCreation(self) 109 108 self.introspection = DatabaseIntrospection(self) 110 109 self.validation = BaseDatabaseValidation(self) 111 110 111 def _set_extension(self): 112 if self.connection: 113 psycopg2.extensions.register_type(psycopg2.extensions.UNICODE, self.connection) 114 112 115 def _cursor(self): 113 116 new_connection = False 114 117 set_tz = False … … 134 137 if settings_dict['PORT']: 135 138 conn_params['port'] = settings_dict['PORT'] 136 139 self.connection = Database.connect(**conn_params) 140 self._set_extension() 137 141 self.connection.set_client_encoding('UTF8') 138 142 self.connection.set_isolation_level(self.isolation_level) 139 143 connection_created.send(sender=self.__class__)