return nothing if no GA credentials supplied
This commit is contained in:
parent
4d18d1c13d
commit
e7093b3f67
|
@ -20,7 +20,7 @@ class GAController(BaseController):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
# XXX hack to provide consistent cache key; what's the
|
# XXX hack to provide consistent cache key; what's the
|
||||||
# canonical way of doing caching like this in CKAN right now?
|
# canonical way of doing caching like this in CKAN right now?
|
||||||
return "analyticscontroller"
|
return "analyticscontrollerx"
|
||||||
|
|
||||||
def get_top_packages(self):
|
def get_top_packages(self):
|
||||||
packages_data = self._get_ga_data()
|
packages_data = self._get_ga_data()
|
||||||
|
@ -43,6 +43,8 @@ class GAController(BaseController):
|
||||||
username = config.get('googleanalytics.username')
|
username = config.get('googleanalytics.username')
|
||||||
password = config.get('googleanalytics.password')
|
password = config.get('googleanalytics.password')
|
||||||
profile_name = config.get('googleanalytics.profile_name')
|
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 = client.AnalyticsClient(source=SOURCE_APP_NAME)
|
||||||
my_client.ClientLogin(username,
|
my_client.ClientLogin(username,
|
||||||
password,
|
password,
|
||||||
|
|
Loading…
Reference in New Issue