Better Vallieres workaround: specify utf-8 charset ;)
authorW. Trevor King <wking@drexel.edu>
Sat, 26 Jun 2010 22:35:07 +0000 (18:35 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 26 Jun 2010 22:40:37 +0000 (18:40 -0400)
sitecore/prof/export_mysql.py

index c629c46e861a59952e9cc2006a6697d1119b1872..ba6bece5d16e0a48833c897884a1e8f5fe7e0a9e 100644 (file)
@@ -56,7 +56,8 @@ class SimpleDB (object):
         self.logger.info('logging in to %s:%s as %s'
                          % (host, database, username))
         self.db = MySQLdb.connect(host=host, user=username,
-                                  passwd=password, db=database)
+                                  passwd=password, db=database,
+                                  charset='UTF8')
         del(username)
         del(password)
         self.cursor = self.db.cursor()
@@ -68,7 +69,7 @@ class SimpleDB (object):
 
     def execute(self, command):
         self.logger.info(command)
-        self.cursor.execute(command)
+        self.cursor.execute(command.encode('utf-8'))
 
     def set_default_table(self, table):
         self.table = table
@@ -169,8 +170,6 @@ Where the relevant categories are
                 first_middle=prof['firstname'],
                 last=prof['lastname'],
                 )
-            if p.name.last.encode('hex') == '56616c6c69e8726573':
-                p.name.last = u'Valli\xe8res'
             p.title = prof['position']
             if prof['position1'] != None:
                 p.title += ', %s' % prof['position1']