Commit bd5982d3 authored by mouadh's avatar mouadh

remove consecutive if-statements

parent ae0b8fb0
...@@ -61,16 +61,12 @@ class XmlaProviderService(ServiceBase): ...@@ -61,16 +61,12 @@ class XmlaProviderService(ServiceBase):
ctx.out_header = Session(SessionId=str(XmlaProviderService.sessio_id)) ctx.out_header = Session(SessionId=str(XmlaProviderService.sessio_id))
config_parser = ConfigParser(discover_tools.executer.cube_path) config_parser = ConfigParser(discover_tools.executer.cube_path)
if config_parser.xmla_authentication(): if config_parser.xmla_authentication() and ctx.transport.req_env['QUERY_STRING'] != 'admin':
raise InvalidCredentialsError(
fault_string='You do not have permission to access this resource',
fault_object=None)
# TODO call (labster) login function or create login with token (according to labster db) # TODO call (labster) login function or create login with token (according to labster db)
if ctx.transport.req_env['QUERY_STRING'] != 'admin':
raise InvalidCredentialsError(
fault_string='You do not have permission to access this resource',
fault_object=None)
# raise AuthenticationError()
if request.RequestType == "DISCOVER_DATASOURCES": if request.RequestType == "DISCOVER_DATASOURCES":
return discover_tools.discover_datasources_response() return discover_tools.discover_datasources_response()
......
...@@ -165,8 +165,8 @@ class XmlaDiscoverTools(): ...@@ -165,8 +165,8 @@ class XmlaDiscoverTools():
""") """)
def discover_schema_rowsets_response(self, request): def discover_schema_rowsets_response(self, request):
if request.Restrictions.RestrictionList.SchemaName == "MDSCHEMA_HIERARCHIES": if request.Restrictions.RestrictionList.SchemaName == "MDSCHEMA_HIERARCHIES" and \
if request.Properties.PropertyList.Catalog is not None: request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog) self.change_catalogue(request.Properties.PropertyList.Catalog)
return etree.fromstring(""" return etree.fromstring("""
<return> <return>
...@@ -218,8 +218,8 @@ class XmlaDiscoverTools(): ...@@ -218,8 +218,8 @@ class XmlaDiscoverTools():
</root> </root>
</return> </return>
""") """)
if request.Restrictions.RestrictionList.SchemaName == 'MDSCHEMA_MEASURES': if request.Restrictions.RestrictionList.SchemaName == 'MDSCHEMA_MEASURES' and \
if request.Properties.PropertyList.Catalog is not None: request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog) self.change_catalogue(request.Properties.PropertyList.Catalog)
return etree.fromstring(""" return etree.fromstring("""
<return> <return>
......
...@@ -302,10 +302,10 @@ class XmlaExecuteTools(): ...@@ -302,10 +302,10 @@ class XmlaExecuteTools():
""" """
columns_loop = [] columns_loop = []
if (len(mdx_execution_result['columns_desc']['columns'].keys()) == 0 if (
) ^ (len(mdx_execution_result['columns_desc']['rows'].keys()) == 0): (len(mdx_execution_result['columns_desc']['columns'].keys()) == 0
if self.executer.facts in mdx_execution_result['columns_desc'][ ) ^ (len(mdx_execution_result['columns_desc']['rows'].keys()) == 0)
'all'].keys(): ) and self.executer.facts in mdx_execution_result['columns_desc']['all'].keys():
# iterate DataFrame horizontally # iterate DataFrame horizontally
columns_loop = itertools.chain(* [ columns_loop = itertools.chain(* [
......
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