]> git.saurik.com Git - cyql.git/commitdiff
Adjusted inspect.currentframe() to account for @contextmanager.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 12 May 2010 12:51:33 +0000 (12:51 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 12 May 2010 12:51:33 +0000 (12:51 +0000)
__init__.py

index 6eafaee13b6d2f4e60736a1540231bca0577d748..00a4573ecb89212cd8031cc43a340d1b90b68628 100644 (file)
@@ -27,7 +27,8 @@ class connection(object):
     @contextmanager
     def execute(self, statement, depth=0):
         with self.cursor() as cursor:
-            locals = inspect.currentframe(depth + 1).f_locals
+            # two frames, accounting for execute() and @contextmanager
+            locals = inspect.currentframe(depth + 2).f_locals
             cursor.execute(statement.format(**locals), locals)
             yield cursor