예제 #1
0
    def home(self):
        extra_vars = {}

        # Get the dataset count using search
        # (shouldn't cache, as it makes it more likely to be out of sync with
        # the data page)
        from ckan.lib.search import SearchError, SearchQueryError
        context = {
            'model': model,
            'session': model.Session,
            'user': c.user or c.author,
            'for_view': True,
            'auth_user_obj': c.userobj
        }
        data_dict = {
            'q': '*:*',
            'fq': '+dataset_type:dataset',
            #'facet.field': facets.keys(),
            'rows': 0,
        }
        query = get_action('package_search')(context, data_dict)
        extra_vars['num_datasets'] = query['count']

        extra_vars['themes'] = get_themes()

        return render('data/home.html', extra_vars=extra_vars)
예제 #2
0
    def test_get_themes(self):
        themes = get_themes()

        assert_equal(len(themes), 12)
        assert_equal(themes[0][0], 'Business and economy')
        assert_equal(themes[0][1], 'Business & Economy')
        assert_equal(themes[0][2], 'Small businesses, industry, imports, exports and trade')
    def test_get_themes(self):
        themes = get_themes()

        assert_equal(len(themes), 12)
        assert_equal(themes[0][0], 'Business and economy')
        assert_equal(themes[0][1], 'Business & Economy')
        assert_equal(themes[0][2],
                     'Small businesses, industry, imports, exports and trade')
예제 #4
0
    def home(self):
        extra_vars = {}

        # Get the dataset count using search
        # (shouldn't cache, as it makes it more likely to be out of sync with
        # the data page)
        from ckan.lib.search import SearchError, SearchQueryError
        context = {'model': model, 'session': model.Session,
                   'user': c.user or c.author, 'for_view': True,
                   'auth_user_obj': c.userobj}
        data_dict = {
                'q': '*:*',
                'fq': '+dataset_type:dataset',
                #'facet.field': facets.keys(),
                'rows': 0,
            }
        query = get_action('package_search')(context, data_dict)
        extra_vars['num_datasets'] = query['count']

        extra_vars['themes'] = get_themes()

        return render('data/home.html', extra_vars=extra_vars)