52 |
|
|
53 |
from domutils import getElementsByName, getElementByName |
from domutils import getElementsByName, getElementByName |
54 |
|
|
55 |
|
from Thuban import _ |
56 |
|
|
57 |
class WMSCapabilitiesParser: |
class WMSCapabilitiesParser: |
58 |
""" |
""" |
59 |
Thuban class to parse capabilities supplied as large string. |
Thuban class to parse capabilities supplied as large string. |
70 |
access = None |
access = None |
71 |
formats = None |
formats = None |
72 |
srs_discrepancies = None |
srs_discrepancies = None |
73 |
|
error = None |
74 |
|
|
75 |
|
|
76 |
def __init__(self): |
def __init__(self): |
81 |
# Note that we must not initialise internal variables of the |
# Note that we must not initialise internal variables of the |
82 |
# class in a mutable way or it will be shared among all |
# class in a mutable way or it will be shared among all |
83 |
# instances. None is immutable, [] is not. |
# instances. None is immutable, [] is not. |
84 |
layers = [] |
self.error = [] |
85 |
|
|
86 |
|
|
87 |
def grok(self, data): |
def grok(self, data): |
155 |
foo = getElementByName(top, 'Title') |
foo = getElementByName(top, 'Title') |
156 |
if foo and len(foo.childNodes[0].data): |
if foo and len(foo.childNodes[0].data): |
157 |
self.layers[index]['title'] = foo.childNodes[0].data |
self.layers[index]['title'] = foo.childNodes[0].data |
158 |
|
else: |
159 |
|
# A <Title> is required for each layer, <name> is optional |
160 |
|
# See OGC 01-068r3, 7.1.4.5.1 and 7.1.4.5.2 |
161 |
|
self.error.append(_("No title found for layer #%d") % index) |
162 |
|
|
163 |
foo = getElementByName(top, 'Name') |
foo = getElementByName(top, 'Name') |
164 |
if foo and len(foo.childNodes[0].data): |
if foo and len(foo.childNodes[0].data): |