def add_popularity(cls, pkg_dict): '''Adds the views field from the ga-report plugin, if it is installed''' from pylons import config score = 0 if 'ga-report' in config.get('ckan.plugins'): from ckanext.ga_report.ga_model import get_score_for_dataset score = get_score_for_dataset(pkg_dict['name']) pkg_dict['popularity'] = score
def add_popularity(cls, pkg_dict): '''Adds the views field from the ga-report plugin, if it is installed''' from pylons import config score = 0 if 'ga-report' in config.get('ckan.plugins'): from ckanext.ga_report.ga_model import get_score_for_dataset score = get_score_for_dataset(pkg_dict['name']) pkg_dict['popularity'] = score
def add_popularity(cls, pkg_dict): '''Adds the views field from the ga-report plugin, if it is installed''' from pylons import config score = 0 if asbool(pkg_dict.get('unpublished', False)): from ckanext.dgu.lib.helpers import feedback_comment_count score += feedback_comment_count(pkg_dict) log.debug('Updated score for unpublished item {0} to {1}'.format(pkg_dict['name'], score)) if 'ga-report' in config.get('ckan.plugins'): from ckanext.ga_report.ga_model import get_score_for_dataset score += get_score_for_dataset(pkg_dict['name']) pkg_dict['popularity'] = score log.info("Popularity for {0} is {1}".format(pkg_dict['name'], pkg_dict['popularity']))
def add_popularity(cls, pkg_dict): '''Adds the views field from the ga-report plugin, if it is installed''' from pylons import config score = 0 if asbool(pkg_dict.get('unpublished', False)): from ckanext.dgu.lib.helpers import feedback_comment_count score += feedback_comment_count(pkg_dict) log.debug('Updated score for unpublished item {0} to {1}'.format( pkg_dict['name'], score)) if 'ga-report' in config.get('ckan.plugins'): from ckanext.ga_report.ga_model import get_score_for_dataset score += get_score_for_dataset(pkg_dict['name']) pkg_dict['popularity'] = score log.info("Popularity for {0} is {1}".format(pkg_dict['name'], pkg_dict['popularity']))
def add_popularity(cls, pkg_dict): '''Adds the views field from the ga-report plugin, if it is installed''' from pylons import config score = 0 try: if asbool(pkg_dict.get('unpublished', False)): from ckanext.dgu.lib.helpers import feedback_comment_count score += feedback_comment_count(pkg_dict) except ValueError: # If the unpublished field is not a proper bool then we should assume it is false pass if 'ga-report' in config.get('ckan.plugins'): from ckanext.ga_report.ga_model import get_score_for_dataset score += get_score_for_dataset(pkg_dict['name']) pkg_dict['popularity'] = score log.debug('Popularity: %s', pkg_dict['popularity'])
def add_popularity(cls, pkg_dict): '''Adds the views field from the ga-report plugin, if it is installed''' from pylons import config score = 0 try: if asbool(pkg_dict.get('unpublished', False)): from ckanext.dgu.lib.helpers import feedback_comment_count score += feedback_comment_count(pkg_dict) except ValueError: # If the unpublished field is not a proper bool then we should assume it is false pass if 'ga-report' in config.get('ckan.plugins'): from ckanext.ga_report.ga_model import get_score_for_dataset score += get_score_for_dataset(pkg_dict['name']) pkg_dict['popularity'] = score log.debug('Popularity: %s', pkg_dict['popularity'])
def add_popularity(cls, pkg_dict): """Adds the views field from the ga-report plugin, if it is installed""" from pylons import config score = 0 try: if asbool(pkg_dict.get("unpublished", False)): from ckanext.dgu.lib.helpers import feedback_comment_count score += feedback_comment_count(pkg_dict) log.debug("Updated score for unpublished item {0} to {1}".format(pkg_dict["name"], score)) except ValueError: # If the unpublished field is not a proper bool then we should assume it is false pass if "ga-report" in config.get("ckan.plugins"): from ckanext.ga_report.ga_model import get_score_for_dataset score += get_score_for_dataset(pkg_dict["name"]) pkg_dict["popularity"] = score log.info("Popularity for {0} is {1}".format(pkg_dict["name"], pkg_dict["popularity"]))