From: Radek Czajka Date: Wed, 1 Oct 2014 08:39:02 +0000 (+0200) Subject: Don't track included API requests. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/ec20d8aad93b7e0ddfa964f68e5ea31424e8aa4e Don't track included API requests. --- 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