Commit 5b866b98 authored by mouadh's avatar mouadh

fix response structure with return

parent fbb5e97b
...@@ -58,29 +58,32 @@ class XmlaDiscoverTools(): ...@@ -58,29 +58,32 @@ class XmlaDiscoverTools():
def discover_datasources_response(): def discover_datasources_response():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml.root(discover_datasources_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml['return']:
**{'xmlns:EX': 'urn:schemas-microsoft-com:xml-analysis:exception', with xml.root(discover_datasources_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', **{'xmlns:EX': 'urn:schemas-microsoft-com:xml-analysis:exception',
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'} 'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}
# "xmlns:EX='urn:schemas-microsoft-com:xml-analysis:exception'"
# "xmlns:xsd='http://www.w3.org/2001/XMLSchema'" # "xmlns:EX='urn:schemas-microsoft-com:xml-analysis:exception'"
# "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'", # "xmlns:xsd='http://www.w3.org/2001/XMLSchema'"
): # "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'",
with xml.row: ):
xml.DataSourceName('sales') with xml.row:
xml.DataSourceDescription('sales Sample Data') xml.DataSourceName('sales')
xml.URL('http://127.0.0.1:8000/xmla') xml.DataSourceDescription('sales Sample Data')
xml.DataSourceInfo('-') xml.URL('http://127.0.0.1:8000/xmla')
xml.ProviderName('olapy') xml.DataSourceInfo('-')
xml.ProviderType('MDP') xml.ProviderName('olapy')
xml.AuthenticationMode('Unauthenticated') xml.ProviderType('MDP')
xml.AuthenticationMode('Unauthenticated')
return """
<return> return xml
{0}
</return> # return """
""".format(str(xml)) # <return>
# {0}
# </return>
# """.format(str(xml))
# return etree.fromstring(""" # return etree.fromstring("""
# <return> # <return>
...@@ -129,17 +132,18 @@ class XmlaDiscoverTools(): ...@@ -129,17 +132,18 @@ class XmlaDiscoverTools():
# </return> # </return>
# """.format(xsd, rows)) # """.format(xsd, rows))
with xml.root(str(xsd), xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml['return']:
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', with xml.root(str(xsd), xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): **{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}):
with xml.row:
xml.PropertyName(PropertyName) with xml.row:
xml.PropertyDescription(PropertyDescription) xml.PropertyName(PropertyName)
xml.PropertyType(PropertyType) xml.PropertyDescription(PropertyDescription)
xml.PropertyAccessType(PropertyAccessType) xml.PropertyType(PropertyType)
xml.IsRequired(IsRequired) xml.PropertyAccessType(PropertyAccessType)
xml.Value(Value) xml.IsRequired(IsRequired)
xml.Value(Value)
# rows = """ # rows = """
# <row> # <row>
# <PropertyName>{0}</PropertyName> # <PropertyName>{0}</PropertyName>
...@@ -168,19 +172,18 @@ class XmlaDiscoverTools(): ...@@ -168,19 +172,18 @@ class XmlaDiscoverTools():
'3', '3',
'15'] '15']
with xml['return']:
with xml.root(str(xsd), xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
with xml.root(str(xsd), xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", **{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}):
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): for idx,prop_desc in enumerate(properties_names_n_description):
for idx,prop_desc in enumerate(properties_names_n_description): with xml.row:
with xml.row: xml.PropertyName(prop_desc)
xml.PropertyName(prop_desc) xml.PropertyDescription(prop_desc)
xml.PropertyDescription(prop_desc) xml.PropertyType(properties_types[idx])
xml.PropertyType(properties_types[idx]) xml.PropertyAccessType('Read')
xml.PropertyAccessType('Read') xml.IsRequired('false')
xml.IsRequired('false') xml.Value(values[idx])
xml.Value(values[idx])
# #
# #
# rows = """ # rows = """
...@@ -242,13 +245,12 @@ class XmlaDiscoverTools(): ...@@ -242,13 +245,12 @@ class XmlaDiscoverTools():
html_parser = HTMLParser.HTMLParser() html_parser = HTMLParser.HTMLParser()
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml
# return xml # return """
return """ # <return>
<return> # {0}
{0} # </return>
</return> # """.format(xml)
""".format(xml)
if request.Restrictions.RestrictionList.PropertyName == 'Catalog': if request.Restrictions.RestrictionList.PropertyName == 'Catalog':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment