Exemple #1
0
def _clear_pycsw(config_path):
    '''
    Loads the PyCSW configuration and runs clear

    :param str config_path: Path to the PyCSW config file
    '''
    from bin import ckan_pycsw
    pycsw_config = ckan_pycsw._load_config(config_path)
    ckan_pycsw.clear(pycsw_config)
Exemple #2
0
    def _clear_pycsw(self, config_path):
        '''
        Loads the PyCSW configuration and runs clear

        :param str config_path: Path to the PyCSW config file
        '''
        from bin import ckan_pycsw
        pycsw_config = ckan_pycsw._load_config(config_path)
        ckan_pycsw.clear(pycsw_config)
Exemple #3
0
def _sync_pycsw(config_path):
    '''
    Loads the PyCSW configuration and runs load

    :param str config_path: Path to the PyCSW config file
    '''
    from bin import ckan_pycsw
    pycsw_config = ckan_pycsw._load_config(config_path)
    ckan_url = pycsw_config.get('ckan', 'url')
    ckan_pycsw.load(pycsw_config, ckan_url)
Exemple #4
0
    def _sync_pycsw(self, config_path):
        '''
        Loads the PyCSW configuration and runs load

        :param str config_path: Path to the PyCSW config file
        '''
        from bin import ckan_pycsw
        pycsw_config = ckan_pycsw._load_config(config_path)
        ckan_url = pycsw_config.get('ckan', 'url')
        ckan_pycsw.load(pycsw_config, ckan_url)
Exemple #5
0
    def command(self):
        if len(self.args) == 0:
            self.parser.print_usage()
            sys.exit(1)

        config = ckan_pycsw._load_config(self.options.pycsw_config)
        cmd = self.args[0]
        if cmd == 'setup':
            ckan_pycsw.setup_db(config)
        elif cmd == 'load':
            ckan_url = self.options.ckan_url
            ckan_pycsw.load(config, ckan_url)
        elif cmd == 'clear':
            ckan_pycsw.clear(config)
        else:
            print 'Command %s not recognized' % cmd
Exemple #6
0
    def command(self):
        if len(self.args) == 0:
            self.parser.print_usage()
            sys.exit(1)

        config = ckan_pycsw._load_config(self.options.pycsw_config)
        cmd = self.args[0]
        if cmd == 'setup':
            ckan_pycsw.setup_db(config)
        elif cmd in ['load', 'set_keywords']:
            ckan_url = self.options.ckan_url.rstrip('/') + '/'
            if cmd == 'load':
                ckan_pycsw.load(config, ckan_url)
            else:
                ckan_pycsw.set_keywords(self.options.pycsw_config, config, ckan_url)
        elif cmd == 'clear':
            ckan_pycsw.clear(config)
        else:
            print('Command %s not recognized' % cmd)