[GRASS-SVN] r37082 - grass/trunk/scripts/r.in.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 9 14:39:41 EDT 2009
Author: martinl
Date: 2009-05-09 14:39:40 -0400 (Sat, 09 May 2009)
New Revision: 37082
Modified:
grass/trunk/scripts/r.in.wms/r.in.wms.py
Log:
r.in.wms: fix r37081 (cap_file)
Modified: grass/trunk/scripts/r.in.wms/r.in.wms.py
===================================================================
--- grass/trunk/scripts/r.in.wms/r.in.wms.py 2009-05-09 18:36:11 UTC (rev 37081)
+++ grass/trunk/scripts/r.in.wms/r.in.wms.py 2009-05-09 18:39:40 UTC (rev 37082)
@@ -195,23 +195,24 @@
url = options['mapserver'] + '?' + qstring
try:
if options['cap_file']:
- cap_file = urllib.urlretrieve(url, options['cap_file'])
+ cap_file, headers = urllib.urlretrieve(url, options['cap_file'])
else:
cap_file = urllib.urlopen(url, options['mapserver'] + '?' + qstring)
except IOError:
grass.fatal("Unable to get capabilities of '%s'" % options['mapserver'])
# check DOCTYPE first
- if cap_file.info()['content-type'] != 'application/vnd.ogc.wms_xml':
- grass.fatal("Unable to get capabilities: %s" % url)
+ if options['cap_file']:
+ if headers['content-type'] != 'application/vnd.ogc.wms_xml':
+ grass.fatal("Unable to get capabilities: %s" % url)
+ else:
+ if cap_file.info()['content-type'] != 'application/vnd.ogc.wms_xml':
+ grass.fatal("Unable to get capabilities: %s" % url)
# parse file with sax
cap_xml = wms_parse.ProcessCapFile()
try:
- if options['cap_file']:
- xml.sax.parse(options['cap_file'], cap_xml)
- else:
- xml.sax.parse(cap_file, cap_xml)
+ xml.sax.parse(cap_file, cap_xml)
except xml.sax.SAXParseException, err:
grass.fatal("Reading capabilities failed. "
"Unable to parse XML document: %s" % err)
More information about the grass-commit
mailing list