From e7093b3f67913640e52088ce11b7281b35ea8aac Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Fri, 11 Feb 2011 11:24:15 +0000 Subject: [PATCH] return nothing if no GA credentials supplied --- ckanext/googleanalytics/controller.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckanext/googleanalytics/controller.py b/ckanext/googleanalytics/controller.py index 3fc8c95..d452baa 100644 --- a/ckanext/googleanalytics/controller.py +++ b/ckanext/googleanalytics/controller.py @@ -20,7 +20,7 @@ class GAController(BaseController): def __str__(self): # XXX hack to provide consistent cache key; what's the # canonical way of doing caching like this in CKAN right now? - return "analyticscontroller" + return "analyticscontrollerx" def get_top_packages(self): packages_data = self._get_ga_data() @@ -43,6 +43,8 @@ class GAController(BaseController): username = config.get('googleanalytics.username') password = config.get('googleanalytics.password') profile_name = config.get('googleanalytics.profile_name') + if not username or not password or not profile_name: + return [] my_client = client.AnalyticsClient(source=SOURCE_APP_NAME) my_client.ClientLogin(username, password,