Switch to unified view

a/Allura/allura/lib/patches.py b/Allura/allura/lib/patches.py
...
...
76
                and not response_type and len(request.params)==0):
76
                and not response_type and len(request.params)==0):
77
            raise webob.exc.HTTPMovedPermanently(location=request.url+'/')
77
            raise webob.exc.HTTPMovedPermanently(location=request.url+'/')
78
        return func(*args, **kwargs)
78
        return func(*args, **kwargs)
79
79
80
80
81
# must be saved outside the newrelic() method so that multiple newrelic()
82
# calls (e.g. during tests) don't cause the patching to get applied to itself
83
# over and over
84
old_controller_call = tg.controllers.DecoratedController._call
85
81
def newrelic():
86
def newrelic():
82
    old_call = tg.controllers.DecoratedController._call
83
84
    @h.monkeypatch(tg.controllers.DecoratedController,
87
    @h.monkeypatch(tg.controllers.DecoratedController,
85
                   tg.controllers.decoratedcontroller.DecoratedController)
88
                   tg.controllers.decoratedcontroller.DecoratedController)
86
    def _call(self, controller, *args, **kwargs):
89
    def _call(self, controller, *args, **kwargs):
87
        '''Set NewRelic transaction name to actual controller name'''
90
        '''Set NewRelic transaction name to actual controller name'''
88
        import newrelic.agent
91
        import newrelic.agent
89
        newrelic.agent.set_transaction_name(newrelic.agent.callable_name(controller))
92
        newrelic.agent.set_transaction_name(newrelic.agent.callable_name(controller))
90
        return old_call(self, controller, *args, **kwargs)
93
        return old_controller_call(self, controller, *args, **kwargs)