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')
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')
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)
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' )
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')
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
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')
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)
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)
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)
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
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)
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)
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)
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')
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
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
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
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')
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')
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')
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')
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')
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')
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')
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')
def update_config(self, config): toolkit.add_ckan_admin_tab(config, 'admin_dashboard', 'Dashboard')
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')
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')
def update_config(self, config_): tk.add_ckan_admin_tab(config_, 'dcatapit_core.thesaurus', 'Thesaurus File Uploader', icon='book')
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')
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')