Commit cec860bd authored by Michel Rouly's avatar Michel Rouly
Browse files

Merge pull request #1 from creffett/piwik

Don't die if we haven't defined PIWIK_{URL,SITE_ID} or can't contact the piwik server
parents c15f51ae 41e11508
...@@ -225,9 +225,15 @@ def redirection(request, short): ...@@ -225,9 +225,15 @@ def redirection(request, short):
from piwikapi.tracking import PiwikTracker from piwikapi.tracking import PiwikTracker
from django.conf import settings from django.conf import settings
piwiktracker = PiwikTracker(settings.PIWIK_SITE_ID, request) # First, if PIWIK variables are undefined, don't try to push
piwiktracker.set_api_url(settings.PIWIK_URL) if settings.PIWIK_SITE_ID is not "" and settings.PIWIK_URL is not "":
piwiktracker.do_track_page_view('Redirect to %s' % url.target) try:
piwiktracker = PiwikTracker(settings.PIWIK_SITE_ID, request)
piwiktracker.set_api_url(settings.PIWIK_URL)
piwiktracker.do_track_page_view('Redirect to %s' % url.target)
# Second, if we do get an error, don't let that keep us from redirecting
except:
pass
return redirect( url.target ) return redirect( url.target )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment