Ejemplo n.º 1
0
    def _create_or_update_csw_record(self, session, pkg_dict):
        '''Sync dataset with CSW record'''
        
        pkg_id = pkg_dict['id']

        if pkg_dict.get('state', 'active') != 'active':
            log1.info(
                'Skipped sync of non-active dataset %s to CSW record' % (pkg_id))
            return

        record = ext_pycsw_sync.create_or_update_record(session, pkg_dict)
        if record: 
            log1.info('Saved CswRecord %s (%s)', record.identifier, record.title)
        else:
            log1.warning('Failed to save CswRecord for dataset %s' %(pkg_id))
        
        return
Ejemplo n.º 2
0
    def _create_or_update_csw_record(self, session, pkg_dict):
        '''Sync dataset with CSW record'''

        pkg_id = pkg_dict['id']

        if pkg_dict.get('state', 'active') != 'active':
            log1.info('Skipped sync of non-active dataset %s to CSW record' %
                      (pkg_id))
            return

        record = ext_pycsw_sync.create_or_update_record(session, pkg_dict)
        if record:
            log1.info('Saved CswRecord %s (%s)', record.identifier,
                      record.title)
        else:
            log1.warning('Failed to save CswRecord for dataset %s' % (pkg_id))

        return
Ejemplo n.º 3
0
 def test_csw_hooks(self, id):
     from ckanext.publicamundi.lib import pycsw_sync
     context = {'model': model, 'session': model.Session, 'api_version': 3}
     pkg_dict = toolkit.get_action('package_show')(context, {'id': id})
     pycsw_sync.create_or_update_record(context['session'], pkg_dict)
     return ['Done']
Ejemplo n.º 4
0
 def test_csw_hooks(self, id):
     from ckanext.publicamundi.lib import pycsw_sync
     context = {'model': model, 'session': model.Session, 'api_version': 3}
     pkg_dict = toolkit.get_action('package_show')(context, {'id': id})
     pycsw_sync.create_or_update_record(context['session'], pkg_dict)
     return ['Done']