AIFDR / riab

Risk in a Box - main project
Other
17 stars 6 forks source link

Problem with shapefile sans .sld upload to geonode #181

Open uniomni opened 12 years ago

uniomni commented 12 years ago

Having problems uploading shape files:

One is this

Traceback (most recent call last): File "/home/nielso/dev/riab_env/bin/risiko-upload", line 7, in execfile(file) File "/home/nielso/dev/riab/scripts/risiko-upload", line 34, in check_metadata=True) File "/home/nielso/dev/riab/impact/storage/io.py", line 1005, in save_to_geonode ignore=ignore) File "/home/nielso/dev/riab/impact/storage/io.py", line 852, in save_file_to_geonode overwrite=overwrite) File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/utils.py", line 571, in file_upload new_layer = save(layer, filename, theuser, overwrite, workspace=workspace, keywords=keywords) File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/utils.py", line 397, in save sld = get_sld_for(publishing) File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/gs_helpers.py", line 101, in get_sld_for if layer.default_style is not None: File "/home/nielso/dev/riab_env/src/gsconfig.py/src/geoserver/layer.py", line 89, in _get_default_style name = self.dom.find("defaultStyle/name").text AttributeError: 'NoneType' object has no attribute 'text'

Another is this Traceback (most recent call last): File "/home/nielso/dev/riab_env/bin/risiko-upload", line 7, in execfile(file) File "/home/nielso/dev/riab/scripts/risiko-upload", line 34, in check_metadata=True) File "/home/nielso/dev/riab/impact/storage/io.py", line 1005, in save_to_geonode ignore=ignore) File "/home/nielso/dev/riab/impact/storage/io.py", line 852, in save_file_to_geonode overwrite=overwrite) File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/utils.py", line 571, in file_upload new_layer = save(layer, filename, theuser, overwrite, workspace=workspace, keywords=keywords) File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/utils.py", line 482, in save saved_layer.verify() File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/models.py", line 797, in verify get_wms() File "/home/nielso/dev/geonode/src/GeoNodePy/geonode/maps/models.py", line 553, in get_wms _wms = WebMapService(wms_url, xml=body) File "/home/nielso/dev/riab_env/src/owslib/owslib/wms.py", line 74, in init self._capabilities = reader.readString(xml) File "/home/nielso/dev/riab_env/src/owslib/owslib/wms.py", line 550, in readString return etree.fromstring(st) File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 964, in XML return parser.close() File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 1254, in close self._parser.Parse("", 1) # end of data xml.parsers.expat.ExpatError: unclosed token: line 5087, column 8

uniomni commented 12 years ago

The problem went away after a cleanout and restart of geonode. However, it'd be worthwhile catching these kind of errors higher up in the food chain. For example if self.dom.find("defaultStyle/name") is None it'd better to produce information in gsconfig. py about what could have caused that condition.