geopython/OWSLib — pull request #40 by amercader (2012-11-01 18:28:08+00:00)
Title: Optional extent element on indentificationInfo

NB: My understanding of ISO subtleties is limited, so feel free to ignore this if not correct

Parsing this particular document I found the following exception.

Traceback (most recent call last):
File "", line 1, in
File "[...]/owslib/owslib/iso.py", line 111, in __init__
self.identificationinfo.append(MD_DataIdentification(val, 'dataset'))
File "[...]/owslib/owslib/iso.py", line 339, in __init__
if extent == None:
AttributeError: 'NoneType' object has no attribute 'findall'

The file parsed is this document. Note that there are two md:identificationInfo elements, one of which does not have an extent:

http://web.apps.state.nd.us/hubdataportal/srv/en/csw?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetRecordById&ID=f9c45457-e63f-4499-888c-05fd960d4378&outputSchema=http://www.isotc211.org/2005/gmd

If understand correctly the ISO spec document (6.3.2.2), the extent elements are optional, so my patch if there is any extent before trying to do more stuff with it.

Also since 077054 'srv:extent' is also used to get the extent element, but the paths used for the getting temporal extent were not taking this into account.

I'm not sure if self.extent, self.temporalextent_start, etc. should still be set to None if the extent is missing.

Hope all makes sense.