damned-lies r1323 - in trunk: . stats/management/commands



Author: stephaner
Date: Thu Jan  8 10:33:12 2009
New Revision: 1323
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1323&view=rev

Log:
2009-01-08  StÃphane Raimbault  <stephane raimbault gmail com>

	* stats/management/commands/update-trans.py: Use ANSI_QUOTES with
	MySQL to not break the SQL compatibility.


Modified:
   trunk/ChangeLog
   trunk/stats/management/commands/update-trans.py

Modified: trunk/stats/management/commands/update-trans.py
==============================================================================
--- trunk/stats/management/commands/update-trans.py	(original)
+++ trunk/stats/management/commands/update-trans.py	Thu Jan  8 10:33:12 2009
@@ -2,6 +2,7 @@
 from django.core.management.commands import makemessages
 from django.db import connection
 from optparse import make_option
+from stats.conf import settings
 import os
 import shutil
 
@@ -37,12 +38,14 @@
         dbfile = os.path.join(os.path.abspath('.'), 'database-content.py')
         f=open(dbfile, 'w')
         query = """SELECT description FROM team UNION DISTINCT
-                   SELECT name from `language` WHERE name <> locale UNION DISTINCT
+                   SELECT name from language WHERE name <> locale UNION DISTINCT
                    SELECT description FROM domain UNION DISTINCT
                    SELECT description FROM module WHERE description <> name UNION DISTINCT
-                   SELECT comment FROM module WHERE comment IS NOT NULL AND comment<>'' UNION DISTINCT
-                   SELECT description FROM `release`;"""
+                   SELECT comment FROM module WHERE comment IS NOT NULL AND comment <> '' UNION DISTINCT
+                   SELECT description FROM "release" """
         cursor = connection.cursor()
+        if settings.DATABASE_ENGINE == 'mysql':
+            cursor.execute("SET sql_mode='ANSI_QUOTES'")
         cursor.execute(query)
         for row in cursor.fetchall():
             if row[0] is not None and row[0] != '':



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]