Пример #1
0
 def update_config(self, config):
     tk.add_template_directory(config, 'templates')
     tk.add_public_directory(config, 'public')
     tk.add_resource('fanstatic', 'project')
     # If ckan is more than 2.3, use the 2.4+ toolkit method
     if not tk.check_ckan_version(max_version='2.3'):
         tk.add_ckan_admin_tab(config, 'ckanext_project_admins', 'project Config')
Пример #2
0
 def update_config(self, config):
     tk.add_template_directory(config, 'templates')
     tk.add_public_directory(config, 'public')
     # If ckan is more than 2.3, use the 2.4+ toolkit method
     if not tk.check_ckan_version(max_version='2.3'):
         tk.add_ckan_admin_tab(config, 'ckanext_showcase_admins',
                               'Showcase Config')
Пример #3
0
    def test_add_ckan_admin_tab_updates_config_dict(self):
        '''Config dict updated by toolkit.add_ckan_admin_tabs method.'''
        config = {}

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')

        nosetools.assert_equal({'ckan.admin_tabs': {'my_route_name': 'my_label'}}, config)
Пример #4
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'drupal_menu_sync')
     toolkit.add_ckan_admin_tab(
         config_, 'drupal_menu_sync_admin', 'Manage Menu sync'
     )
Пример #5
0
 def update_config(self, config):
     # Add extension templates directory
     toolkit.add_template_directory(config, 'templates')
     # Add a new ckan-admin tabs for our extension
     toolkit.add_ckan_admin_tab(config, 'ckanext_myext_config_one',
                                'My First Custom Config Tab')
     toolkit.add_ckan_admin_tab(config, 'ckanext_myext_config_two',
                                'My Second Custom Config Tab')
Пример #6
0
	def update_config(self, config):
		tk.add_template_directory(config, 'templates')
		tk.add_public_directory(config, 'public')
		tk.add_resource('fanstatic', 'oauth2provider')

		# Add a new admin tab to ckan-admin
		tk.add_ckan_admin_tab(config, 'oauth2provider_client_list',
								   'OAuth2 Clients')
		tk.add_ckan_admin_tab(config, 'oauth2provider_token_list',
								   'OAuth2 Tokens')
    def test_add_ckan_admin_tab_updates_config_dict(self):
        """Config dict updated by toolkit.add_ckan_admin_tabs method."""
        config = {}

        toolkit.add_ckan_admin_tab(config, "my_route_name", "my_label")

        assert {
            "ckan.admin_tabs": {
                "my_route_name": {
                    "label": "my_label",
                    "icon": None
                }
            }
        } == config
Пример #8
0
    def update_config(self, config_):
        if not tables_exist():
            log.critical(u'''
The lacounts extension requires database initialization. Please run the
following to create the database tables:
    paster --plugin=ckanext-lacounts get_involved init-db
''')
        else:
            log.debug(u'LA Counts "Get Involved" tables exist')

        toolkit.add_template_directory(config_, 'templates')
        toolkit.add_public_directory(config_, 'public')
        toolkit.add_resource('fanstatic', 'lacounts')
        toolkit.add_ckan_admin_tab(config_, 'getinvolved_admin',
                                   'Get Involved')
Пример #9
0
    def test_add_ckan_admin_tab_twice_replace_value(self):
        '''
        Calling add_ckan_admin_tab twice with a different value returns
        expected config.
        '''
        config = {}

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')
        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_replacement_label')

        expected_dict = {
            'ckan.admin_tabs': {'my_route_name': 'my_replacement_label'}
        }

        nosetools.assert_equal(expected_dict, config)
Пример #10
0
    def test_add_ckan_admin_tab_updates_config_dict(self):
        '''Config dict updated by toolkit.add_ckan_admin_tabs method.'''
        config = {}

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')

        nosetools.assert_equal(
            {
                'ckan.admin_tabs': {
                    'my_route_name': {
                        'label': 'my_label',
                        'icon': None
                    }
                }
            }, config)
Пример #11
0
    def test_add_ckan_admin_tab_two_routes(self):
        '''
        Add two different route/label pairs to ckan.admin_tabs.
        '''
        config = {}

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')
        toolkit.add_ckan_admin_tab(config, 'my_other_route_name', 'my_other_label')

        expected_dict = {
            'ckan.admin_tabs': {
                'my_other_route_name': 'my_other_label',
                'my_route_name': 'my_label'
            }
        }

        nosetools.assert_equal(expected_dict, config)
Пример #12
0
    def test_add_ckan_admin_tab_twice(self):
        """
        Calling add_ckan_admin_tab twice with same values returns expected
        config.
        """
        config = {}

        toolkit.add_ckan_admin_tab(config, "my_route_name", "my_label")
        toolkit.add_ckan_admin_tab(config, "my_route_name", "my_label")

        expected_dict = {
            "ckan.admin_tabs": {
                "my_route_name": {"label": "my_label", "icon": None}
            }
        }

        assert expected_dict == config
Пример #13
0
    def test_add_ckan_admin_tab_config_has_existing_other_option(self):
        '''
        Config already has existing other option.
        '''
        config = {'ckan.my_option': 'This is my option'}

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')
        toolkit.add_ckan_admin_tab(config, 'my_other_route_name',
                                   'my_other_label')

        expected_dict = {
            'ckan.my_option': 'This is my option',
            'ckan.admin_tabs': {
                'my_other_route_name': 'my_other_label',
                'my_route_name': 'my_label'
            }
        }

        nosetools.assert_equal(expected_dict, config)
Пример #14
0
    def test_add_ckan_admin_tab_config_has_existing_other_option(self):
        '''
        Config already has existing other option.
        '''
        config = {
            'ckan.my_option': 'This is my option'
        }

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')
        toolkit.add_ckan_admin_tab(config, 'my_other_route_name', 'my_other_label')

        expected_dict = {
            'ckan.my_option': 'This is my option',
            'ckan.admin_tabs': {
                'my_other_route_name': 'my_other_label',
                'my_route_name': 'my_label'
            }
        }

        nosetools.assert_equal(expected_dict, config)
Пример #15
0
    def test_add_ckan_admin_tab_twice(self):
        '''
        Calling add_ckan_admin_tab twice with same values returns expected
        config.
        '''
        config = {}

        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')
        toolkit.add_ckan_admin_tab(config, 'my_route_name', 'my_label')

        expected_dict = {
            'ckan.admin_tabs': {
                'my_route_name': {
                    'label': 'my_label',
                    'icon': None
                }
            }
        }

        nosetools.assert_equal(expected_dict, config)
Пример #16
0
    def configure(self, config_):
        self.dataset_types = OrderedDict([
            (schema['dataset_type'], schema['about'])
            for schema in scheming_helpers.scheming_dataset_schemas().values()
        ])
        self.member_countries = OrderedDict([
            (choice['value'], choice['label'])
            for choice in scheming_helpers.scheming_get_preset(
                'member_countries')['choices']
        ])

        filepath = os.path.join(os.path.dirname(__file__), 'data/eez.json')
        if os.path.isfile(filepath):
            with open(filepath) as file:
                logger.debug('Updating EEZ list')
                collection = json.load(file)
                spc_utils.eez.update(collection['features'])

        toolkit.add_ckan_admin_tab(config_, 'search_queries.index',
                                   'Search Queries')
        toolkit.add_ckan_admin_tab(config_, 'ingest.index', 'Ingest')
Пример #17
0
    def test_add_ckan_admin_tab_twice_replace_value(self):
        """
        Calling add_ckan_admin_tab twice with a different value returns
        expected config.
        """
        config = {}

        toolkit.add_ckan_admin_tab(config, "my_route_name", "my_label")
        toolkit.add_ckan_admin_tab(config, "my_route_name",
                                   "my_replacement_label")

        expected_dict = {
            "ckan.admin_tabs": {
                "my_route_name": {
                    "label": "my_replacement_label",
                    "icon": None,
                }
            }
        }

        assert expected_dict == config
Пример #18
0
    def test_add_ckan_admin_tab_two_routes(self):
        """
        Add two different route/label pairs to ckan.admin_tabs.
        """
        config = {}

        toolkit.add_ckan_admin_tab(config, "my_route_name", "my_label")
        toolkit.add_ckan_admin_tab(
            config, "my_other_route_name", "my_other_label"
        )

        expected_dict = {
            "ckan.admin_tabs": {
                "my_other_route_name": {
                    "label": "my_other_label",
                    "icon": None,
                },
                "my_route_name": {"label": "my_label", "icon": None},
            }
        }

        assert expected_dict == config
Пример #19
0
    def test_add_ckan_admin_tab_config_has_existing_other_option(self):
        """
        Config already has existing other option.
        """
        config = {"ckan.my_option": "This is my option"}

        toolkit.add_ckan_admin_tab(config, "my_route_name", "my_label")
        toolkit.add_ckan_admin_tab(
            config, "my_other_route_name", "my_other_label"
        )

        expected_dict = {
            "ckan.my_option": "This is my option",
            "ckan.admin_tabs": {
                "my_other_route_name": {
                    "label": "my_other_label",
                    "icon": None,
                },
                "my_route_name": {"label": "my_label", "icon": None},
            },
        }

        assert expected_dict == config
Пример #20
0
    def update_config(self, config):
        conf_directive = 'nsw.report.broken_links_filepath'
        if not config.get(conf_directive):
            raise KeyError(
                'Please, specify `{}` inside your config file'.format(
                    conf_directive))

        # Add this plugin's templates dir to CKAN's extra_template_paths, so
        # that CKAN will use this plugin's custom templates.
        tk.add_template_directory(config, 'templates')

        # Add this plugin's templates dir to CKAN's extra_template_paths, so
        # that CKAN will use this plugin's custom templates.
        tk.add_public_directory(config, 'public')

        # Add this plugin's fanstatic dir.
        tk.add_resource('fanstatic', 'ckanext-nsw')

        if tk.check_ckan_version(min_version='2.4'):
            tk.add_ckan_admin_tab(config, 'broken_links_report', 'Reports')
            tk.add_ckan_admin_tab(config, 'format_mapping', 'Formats')
            tk.add_ckan_admin_tab(config, 'license_mapping', 'Licenses')
Пример #21
0
 def update_config(self, config):
     add_template_directory(config, 'templates')
     add_public_directory(config, 'public')
     # TODO @palcu: translate this string
     add_ckan_admin_tab(config, 'inventory_admin_index', 'Activate Users')
     add_resource('fanstatic', 'inventory')
Пример #22
0
 def update_config(self, config_):
     toolkit.add_ckan_admin_tab(config_, 'ext_status_dashboard', 'My Plugins')
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'needupdate')
Пример #23
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'tayside')
     toolkit.add_ckan_admin_tab(config_, 'ckanext_tayside_footer_logos',
                                'Organization Links')
Пример #24
0
 def update_config(self, config):
     tk.add_template_directory(config, 'templates')
     tk.add_public_directory(config, 'public')
     if tk.check_ckan_version(min_version='2.4'):
         tk.add_ckan_admin_tab(config, 'ckanext_showcase_admins',
                               'Showcase Config')
Пример #25
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'groupadmin')
     toolkit.add_ckan_admin_tab(config_, 'group_admins', 'Group Admins')
Пример #26
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'acl')
     if toolkit.check_ckan_version(min_version='2.4'):
         toolkit.add_ckan_admin_tab(config_, 'manage_permissions', 'Permissions')
Пример #27
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'cadastaroles')
     toolkit.add_ckan_admin_tab(config_, 'cadasta_admins', 'Cadasta Admins')
Пример #28
0
 def update_config(self, config):
     add_template_directory(config, 'templates')
     add_public_directory(config, 'public')
     # TODO @palcu: translate this string
     add_ckan_admin_tab(config, 'inventory_admin_index', 'Activate Users')
     add_resource('fanstatic', 'inventory')
Пример #29
0
 def update_config(self, config):
     toolkit.add_ckan_admin_tab(config, 'admin_dashboard', 'Dashboard')
Пример #30
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'configpermission')
     toolkit.add_ckan_admin_tab(config_, 'management_view', 'Permissions')
Пример #31
0
 def update_config(self, config):
     toolkit.add_ckan_admin_tab(config, 'admin_dashboard', 'Dashboard')
Пример #32
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'drupal_menu_sync')
     toolkit.add_ckan_admin_tab(config_, 'drupal_menu_sync_admin',
                                'Manage Menu sync')
Пример #33
0
 def update_config(self, config_):
     toolkit.add_template_directory(config_, 'templates')
     toolkit.add_public_directory(config_, 'public')
     toolkit.add_resource('fanstatic', 'cadastaroles')
     toolkit.add_ckan_admin_tab(config_, 'cadasta_admins', 'Cadasta Admins')
Пример #34
0
 def update_config(self, config_):
     tk.add_ckan_admin_tab(config_,
                           'dcatapit_core.thesaurus',
                           'Thesaurus File Uploader',
                           icon='book')
Пример #35
0
 def update_config(self, config):
     tk.add_template_directory(config, 'templates')
     tk.add_public_directory(config, 'public')
     if tk.check_ckan_version(min_version='2.4'):
         tk.add_resource('fanstatic', 'ckanext-showcase')
         tk.add_ckan_admin_tab(config, 'ckanext_showcase_admins', 'Showcase Config')
Пример #36
0
 def update_config(self, config):
     toolkit.add_ckan_admin_tab(config, 'admin_broken_links',
                                'Broken links')
     toolkit.add_template_directory(config, 'templates')
     toolkit.add_public_directory(config, 'public')
     toolkit.add_resource('fanstatic', 'validate_links')