Skip to content

Commit

Permalink
fix for postgres unicode bug (Bug#177265)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandology committed Jan 4, 2008
1 parent f54e168 commit 77a888e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/db.py
Expand Up @@ -677,6 +677,8 @@ def __init__(self, **keywords):
def get_db_module(self):
try:
import psycopg2 as db
import psycopg2.extensions
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
except ImportError:
try:
import psycopg as db
Expand All @@ -689,6 +691,10 @@ def _process_insert_query(self, query, tablename, seqname):
seqname = tablename + "_id_seq"
return query + "; SELECT currval('%s')" % seqname

def _load_context(self):
DB._load_context(self)
self.ctx.db.set_client_encoding('UTF8')

class MySQLDB(DB):
def __init__(self, **keywords):
DB.__init__(self)
Expand Down

0 comments on commit 77a888e

Please sign in to comment.