joey: thuban/Extensions/wms parser.py,1.6,1.7

cvs@intevation.de cvs at intevation.de
Tue Apr 13 18:42:50 CEST 2004


Author: joey

Update of /thubanrepository/thuban/Extensions/wms
In directory doto:/tmp/cvs-serv2948

Modified Files:
	parser.py 
Log Message:
Added support for error messages during grok().  They will be
aggregated in an array and may be displayed later.  We may have to add
a classification "Warning" and "Error" to this.  That requires more
experience, though, since not every error may be lethal.

Index: parser.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/wms/parser.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- parser.py	13 Apr 2004 13:15:22 -0000	1.6
+++ parser.py	13 Apr 2004 16:42:48 -0000	1.7
@@ -52,6 +52,8 @@
 
 from domutils import getElementsByName, getElementByName
 
+from Thuban import _
+
 class WMSCapabilitiesParser:
     """
     Thuban class to parse capabilities supplied as large string.
@@ -68,6 +70,7 @@
     access = None
     formats = None
     srs_discrepancies = None
+    error = None
 
 
     def __init__(self):
@@ -78,7 +81,7 @@
         # Note that we must not initialise internal variables of the
         # class in a mutable way or it will be shared among all
         # instances.  None is immutable, [] is not.
-        layers = []
+        self.error = []
 
 
     def grok(self, data):
@@ -152,6 +155,10 @@
         foo = getElementByName(top, 'Title')
         if foo and len(foo.childNodes[0].data):
             self.layers[index]['title'] = foo.childNodes[0].data
+        else:
+            # A <Title> is required for each layer, <name> is optional
+            # See OGC 01-068r3, 7.1.4.5.1 and 7.1.4.5.2
+            self.error.append(_("No title found for layer #%d") % index)
 
         foo = getElementByName(top, 'Name')
         if foo and len(foo.childNodes[0].data):





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)