return nothing if no GA credentials supplied

This commit is contained in:
Seb Bacon 2011-02-11 11:24:15 +00:00
parent 4d18d1c13d
commit e7093b3f67
1 changed files with 3 additions and 1 deletions

View File

@ -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,