You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/03 19:53:00 UTC
git commit: [#5998] avoid very deep recursion during tests
Updated Branches:
refs/heads/master 7a332c6ec -> b4fa50de7
[#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/master
Commit: b4fa50de705735bc4bff6e84edd1caacb84db7cb
Parents: 7a332c6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Fri May 3 17:52:24 2013 +0000
Committer: Dave Brondsema <db...@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)