From ec20d8aad93b7e0ddfa964f68e5ea31424e8aa4e Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 1 Oct 2014 10:39:02 +0200 Subject: [PATCH] Don't track included API requests. --- apps/api/urls.py | 1 + apps/stats/utils.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/api/urls.py b/apps/api/urls.py index e9b106cdc..1c2e656d1 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -37,6 +37,7 @@ def incl(request, model, pk, emitter_format): 'fragment': fragment_list_resource, 'tag': tag_list_resource, }[model] + request.piwik_track = False resp = resource(request, pk=pk, emitter_format=emitter_format) if emitter_format == 'xml': # Ugly, but quick way of stripping header and tags. diff --git a/apps/stats/utils.py b/apps/stats/utils.py index 543f86341..474d1b59a 100644 --- a/apps/stats/utils.py +++ b/apps/stats/utils.py @@ -47,7 +47,8 @@ def piwik_track(klass_or_method): call_func = klass_or_method def wrap(self, request, *args, **kw): - track_request.delay(piwik_url(request)) + if getattr(request, 'piwik_track', True): + track_request.delay(piwik_url(request)) return call_func(self, request, *args, **kw) # and wrap it -- 2.20.1