|
@@ -4,7 +4,11 @@
|
|
|
import urlparse
|
|
import urlparse
|
|
|
import urllib
|
|
import urllib
|
|
|
from lxml import objectify
|
|
from lxml import objectify
|
|
|
-from lxml import etree
|
|
|
|
|
|
|
+try:
|
|
|
|
|
+ from lxml import etree
|
|
|
|
|
+except:
|
|
|
|
|
+ from xml.etree import ElementTree as etree
|
|
|
|
|
+
|
|
|
import os,sys
|
|
import os,sys
|
|
|
import tempfile
|
|
import tempfile
|
|
|
import logging
|
|
import logging
|
|
@@ -17,7 +21,6 @@ from osgeo import ogr
|
|
|
import OWSExceptions
|
|
import OWSExceptions
|
|
|
from owslib import crs as CRS
|
|
from owslib import crs as CRS
|
|
|
import shutil
|
|
import shutil
|
|
|
-from xml.etree import ElementTree
|
|
|
|
|
|
|
|
|
|
class OWS:
|
|
class OWS:
|
|
|
|
|
|
|
@@ -195,7 +198,7 @@ class OWS:
|
|
|
oldCapsFile.close()
|
|
oldCapsFile.close()
|
|
|
# the capabilities document is up-to-date, load existing
|
|
# the capabilities document is up-to-date, load existing
|
|
|
# mapfile
|
|
# mapfile
|
|
|
- newXml = ElementTree.tostring(self.capabilities._capabilities)
|
|
|
|
|
|
|
+ newXml = etree.tostring(self.capabilities._capabilities)
|
|
|
if md5.new(oldCaps).hexdigest() == md5.new(newXml).hexdigest():
|
|
if md5.new(oldCaps).hexdigest() == md5.new(newXml).hexdigest():
|
|
|
newCapsFile = open(os.path.join(self.cachedir,"capabilities.xml"),"w")
|
|
newCapsFile = open(os.path.join(self.cachedir,"capabilities.xml"),"w")
|
|
|
newCapsFile.write(newXml)
|
|
newCapsFile.write(newXml)
|
|
@@ -266,7 +269,7 @@ class OWS:
|
|
|
# cache capabilities document
|
|
# cache capabilities document
|
|
|
if "_capabilities" in dir(self.capabilities):
|
|
if "_capabilities" in dir(self.capabilities):
|
|
|
logging.info("Saving service Capabilities to %s" % os.path.join(self.cachedir,"capabilities.xml"))
|
|
logging.info("Saving service Capabilities to %s" % os.path.join(self.cachedir,"capabilities.xml"))
|
|
|
- open(os.path.join(self.cachedir,"capabilities.xml"),"w").write(ElementTree.tostring(self.capabilities._capabilities))
|
|
|
|
|
|
|
+ open(os.path.join(self.cachedir,"capabilities.xml"),"w").write(etree.tostring(self.capabilities._capabilities))
|
|
|
|
|
|
|
|
else:
|
|
else:
|
|
|
logging.info("Mapfile NOT saved")
|
|
logging.info("Mapfile NOT saved")
|