Blob Blame History Raw
From 7fb9d7b5ac5f0d50dce9336d4a1fdf57c45ecde9 Mon Sep 17 00:00:00 2001
From: Toshio Kuratomi <toshio@fedoraproject.org>
Date: Thu, 11 Apr 2013 15:58:42 -0700
Subject: [PATCH] @q Trace decorator needs to check more lines to work

---
 q.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/q.py b/q.py
index 86e8a14..79e134d 100644
--- a/q.py
+++ b/q.py
@@ -256,8 +256,9 @@ class Q(object):
             lines = info.code_context[:info.index + 1]
 
         # If we see "@q" on a single line, behave like a trace decorator.
-        if lines[-1].strip().startswith('@') and args:
-            return self.trace(args[0])
+        for line in lines:
+            if line.strip().startswith('@q') and args:
+                return self.trace(args[0])
 
         # Otherwise, search for the beginning of the call expression; once it
         # parses, use the expressions in the call to label the debugging output.
-- 
1.7.11.7