incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [39/50] git commit: [#5998] avoid very deep recursion during tests
Date Wed, 08 May 2013 15:35:36 GMT
[#5998] avoid very deep recursion during tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b4fa50de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b4fa50de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b4fa50de

Branch: refs/heads/tv/docs
Commit: b4fa50de705735bc4bff6e84edd1caacb84db7cb
Parents: 7a332c6
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri May 3 17:52:24 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Fri May 3 17:52:24 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/patches.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b4fa50de/Allura/allura/lib/patches.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/patches.py b/Allura/allura/lib/patches.py
index ef6fba5..60c4648 100644
--- a/Allura/allura/lib/patches.py
+++ b/Allura/allura/lib/patches.py
@@ -78,13 +78,16 @@ def apply():
         return func(*args, **kwargs)
 
 
-def newrelic():
-    old_call = tg.controllers.DecoratedController._call
+# must be saved outside the newrelic() method so that multiple newrelic()
+# calls (e.g. during tests) don't cause the patching to get applied to itself
+# over and over
+old_controller_call = tg.controllers.DecoratedController._call
 
+def newrelic():
     @h.monkeypatch(tg.controllers.DecoratedController,
                    tg.controllers.decoratedcontroller.DecoratedController)
     def _call(self, controller, *args, **kwargs):
         '''Set NewRelic transaction name to actual controller name'''
         import newrelic.agent
         newrelic.agent.set_transaction_name(newrelic.agent.callable_name(controller))
-        return old_call(self, controller, *args, **kwargs)
+        return old_controller_call(self, controller, *args, **kwargs)


Mime
View raw message