Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ckanext/spatial/harvesters/csw.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ def get_original_url(self, harvest_object_id):
def output_schema(self):
return 'gmd'

def get_constraints(self, harvest_job):
'''Returns the CSW constraints that should be used during gather stage.
Should be overwritten by sub-classes.
'''
return []

def gather_stage(self, harvest_job):
log = logging.getLogger(__name__ + '.CSW.gather')
log.debug('CswHarvester gather_stage for job: %r', harvest_job)
Expand Down Expand Up @@ -92,7 +98,7 @@ def gather_stage(self, harvest_job):
log.debug('Starting gathering for %s' % url)
guids_in_harvest = set()
try:
for identifier in self.csw.getidentifiers(page=10, outputschema=self.output_schema(), cql=cql):
for identifier in self.csw.getidentifiers(page=10, outputschema=self.output_schema(), cql=cql, constraints=self.get_constraints(harvest_job)):
try:
log.info('Got identifier %s from the CSW', identifier)
if identifier is None:
Expand Down
3 changes: 1 addition & 2 deletions ckanext/spatial/lib/csw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ def getrecords(self, qtype=None, keywords=[],

def getidentifiers(self, qtype=None, typenames="csw:Record", esn="brief",
keywords=[], limit=None, page=10, outputschema="gmd",
startposition=0, cql=None, **kw):
startposition=0, cql=None, constraints=[], **kw):
from owslib.csw import namespaces
constraints = []
csw = self._ows(**kw)

if qtype is not None:
Expand Down