Skip to content

Commit

Permalink
fix CSW 3 GetRecords POST handling (#543) (#545)
Browse files Browse the repository at this point in the history
fix CSW 3 GetRecords parameter handling (#543) (#544)
  • Loading branch information
tomkralidis authored Nov 10, 2017
1 parent e63f2e4 commit 4c29f5a
Show file tree
Hide file tree
Showing 26 changed files with 37 additions and 1,039 deletions.
2 changes: 1 addition & 1 deletion pycsw/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def __init__(self, prefix='csw30'):
},
'parameters': {
'typeNames': {
'values': ['csw:Record']
'values': ['csw:Record', 'csw30:Record']
},
'outputSchema': {
'values': ['http://www.opengis.net/cat/csw/3.0']
Expand Down
7 changes: 4 additions & 3 deletions pycsw/ogc/csw/csw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def getrecords(self):
'elementsetname',
'Missing one of ElementSetName or ElementName parameter(s)')

if 'elementsetname' in self.parent.kvp and 'elementname' in self.parent.kvp:
if 'elementsetname' in self.parent.kvp and 'elementname' in self.parent.kvp and self.parent.kvp['elementname']:
# mutually exclusive required
return self.exceptionreport('NoApplicableCode',
'elementsetname',
Expand Down Expand Up @@ -645,7 +645,7 @@ def getrecords(self):
if ofmt.split('/')[0] in self.parent.kvp['outputformat']:
LOGGER.debug('FOUND OUTPUT MATCH')
formats_match = True
if not formats_match:
if not formats_match and self.parent.environ['HTTP_ACCEPT'] != '*/*':
return self.exceptionreport('InvalidParameterValue',
'outputformat', 'HTTP Accept header (%s) and outputformat (%s) must agree' %
(self.parent.environ['HTTP_ACCEPT'], self.parent.kvp['outputformat']))
Expand Down Expand Up @@ -930,7 +930,8 @@ def getrecords(self):
try:
if (self.parent.kvp['outputschema'] ==
'http://www.opengis.net/cat/csw/3.0' and
'csw:Record' in self.parent.kvp['typenames']):
('csw:Record' in self.parent.kvp['typenames'] or
'csw30:Record' in self.parent.kvp['typenames'])):
# serialize csw:Record inline
searchresults.append(self._write_record(
res, self.parent.repository.queryables['_all']))
Expand Down
2 changes: 1 addition & 1 deletion pycsw/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def dispatch(self, writer=sys.stdout, write_headers=True):
self.request_version)
if self.request_version == '2.0.2':
basic_options.append('version')
if self.request_version == '3.0.0' and 'version' not in self.kvp:
if self.request_version == '3.0.0' and 'version' not in self.kvp and self.requesttype == 'POST':
if 'service' not in self.kvp:
self.kvp['service'] = 'CSW'
basic_options.append('service')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
</ows20:Parameter>
<ows20:Parameter name="typeNames">
<ows20:AllowedValues>
<ows20:Value>csw30:Record</ows20:Value>
<ows20:Value>csw:Record</ows20:Value>
</ows20:AllowedValues>
</ows20:Parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
</ows20:Parameter>
<ows20:Parameter name="typeNames">
<ows20:AllowedValues>
<ows20:Value>csw30:Record</ows20:Value>
<ows20:Value>csw:Record</ows20:Value>
</ows20:AllowedValues>
</ows20:Parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
</ows20:Parameter>
<ows20:Parameter name="typeNames">
<ows20:AllowedValues>
<ows20:Value>csw30:Record</ows20:Value>
<ows20:Value>csw:Record</ows20:Value>
</ows20:AllowedValues>
</ows20:Parameter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
</ows20:Parameter>
<ows20:Parameter name="typeNames">
<ows20:AllowedValues>
<ows20:Value>csw30:Record</ows20:Value>
<ows20:Value>csw:Record</ows20:Value>
</ows20:AllowedValues>
</ows20:Parameter>
Expand Down
Loading

0 comments on commit 4c29f5a

Please sign in to comment.