Commits

Olemis Lang committed 909ca84

BH Multiproduct #355 : Patch for debug_sql belongs in #355 rather than #288

Comments (0)

Files changed (3)

 #t288/t288_r1438538_sql_translate_global_env.diff
 t288/t288_r1438538_sql_translate_global_env_pending.diff
-t288/t288_r1440987_dbcursor_debug_sql.diff
+t355/t355_r1440987_dbcursor_debug_sql.diff
 #t115/t115_r1437383_inherit_product_config.diff
 #t333/t333_r1427886_schema_autoinc.diff
 #t333/t333_r1427886_mp_gen_schema.diff

t288/t288_r1440987_dbcursor_debug_sql.diff

-# HG changeset patch
-# Parent 504ca48f1d77fc904f93d70c60f28440fa7f73e7
-BH Multiproduct #288 : Log translated SQL queries by default at testing time
-
-diff -r 504ca48f1d77 bloodhound_multiproduct/multiproduct/dbcursor.py
---- a/bloodhound_multiproduct/multiproduct/dbcursor.py	Fri Feb 01 00:02:30 2013 -0500
-+++ b/bloodhound_multiproduct/multiproduct/dbcursor.py	Fri Feb 01 00:54:21 2013 -0500
-@@ -16,6 +16,7 @@
- #  specific language governing permissions and limitations
- #  under the License.
- 
-+from trac.db.api import DatabaseManager
- import trac.db.util
- from trac.util import concurrency
- 
-@@ -55,7 +56,9 @@
-     def _translate_sql(self, sql):
-         if self._translator is translator_not_set:
-             self._translator = None
--            if not self.env is None:
-+            if self.env is not None:
-+                if DatabaseManager(self.env).debug_sql:
-+                    self.log = self.env.log
-                 product_prefix = self.env.product.prefix if self.env.product else GLOBAL_PRODUCT
-                 self._translator = BloodhoundProductSQLTranslate(SKIP_TABLES,
-                                                                  TRANSLATE_TABLES,
-diff -r 504ca48f1d77 bloodhound_multiproduct/tests/env.py
---- a/bloodhound_multiproduct/tests/env.py	Fri Feb 01 00:02:30 2013 -0500
-+++ b/bloodhound_multiproduct/tests/env.py	Fri Feb 01 00:54:21 2013 -0500
-@@ -138,6 +138,10 @@
-         config.set('logging', 'log_file', logpath)
-         config.set('logging', 'log_type', 'file')
-         config.set('logging', 'log_level', 'DEBUG')
-+
-+        # Log SQL queries
-+        config.set('trac', 'debug_sql', True)
-+
-         config.save()
-         env.setup_log()
-         env.log.info('%s test case: %s %s',

t355/t355_r1440987_dbcursor_debug_sql.diff

+# HG changeset patch
+# Parent 1bb037ca7ec8b40fdfa36440f2590d209960ecf3
+BH Multiproduct #355 : Log translated SQL queries by default at testing time
+
+diff -r 1bb037ca7ec8 bloodhound_multiproduct/multiproduct/dbcursor.py
+--- a/bloodhound_multiproduct/multiproduct/dbcursor.py	Fri Feb 01 01:15:32 2013 -0500
++++ b/bloodhound_multiproduct/multiproduct/dbcursor.py	Fri Feb 01 01:34:07 2013 -0500
+@@ -16,6 +16,7 @@
+ #  specific language governing permissions and limitations
+ #  under the License.
+ 
++from trac.db.api import DatabaseManager
+ import trac.db.util
+ from trac.util import concurrency
+ 
+@@ -55,7 +56,12 @@
+     def _translate_sql(self, sql):
+         if self._translator is translator_not_set:
+             self._translator = None
+-            if not self.env is None:
++            if self.env is not None:
++                # FIXME: This is the right way to do it but breaks translation
++                #if DatabaseManager(self.env).debug_sql:
++                if (self.env.parent or self.env).config['trac'] \
++                        .get('debug_sql', False):
++                    self.log = self.env.log
+                 product_prefix = self.env.product.prefix if self.env.product else GLOBAL_PRODUCT
+                 self._translator = BloodhoundProductSQLTranslate(SKIP_TABLES,
+                                                                  TRANSLATE_TABLES,
+diff -r 1bb037ca7ec8 bloodhound_multiproduct/tests/env.py
+--- a/bloodhound_multiproduct/tests/env.py	Fri Feb 01 01:15:32 2013 -0500
++++ b/bloodhound_multiproduct/tests/env.py	Fri Feb 01 01:34:07 2013 -0500
+@@ -138,6 +138,10 @@
+         config.set('logging', 'log_file', logpath)
+         config.set('logging', 'log_type', 'file')
+         config.set('logging', 'log_level', 'DEBUG')
++
++        # Log SQL queries
++        config.set('trac', 'debug_sql', True)
++
+         config.save()
+         env.setup_log()
+         env.log.info('%s test case: %s %s',