Commit bd5982d3 authored by mouadh's avatar mouadh

remove consecutive if-statements

parent ae0b8fb0
......@@ -61,16 +61,12 @@ class XmlaProviderService(ServiceBase):
ctx.out_header = Session(SessionId=str(XmlaProviderService.sessio_id))
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)
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":
return discover_tools.discover_datasources_response()
......
......@@ -165,8 +165,8 @@ class XmlaDiscoverTools():
""")
def discover_schema_rowsets_response(self, request):
if request.Restrictions.RestrictionList.SchemaName == "MDSCHEMA_HIERARCHIES":
if request.Properties.PropertyList.Catalog is not None:
if request.Restrictions.RestrictionList.SchemaName == "MDSCHEMA_HIERARCHIES" and \
request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog)
return etree.fromstring("""
<return>
......@@ -218,8 +218,8 @@ class XmlaDiscoverTools():
</root>
</return>
""")
if request.Restrictions.RestrictionList.SchemaName == 'MDSCHEMA_MEASURES':
if request.Properties.PropertyList.Catalog is not None:
if request.Restrictions.RestrictionList.SchemaName == 'MDSCHEMA_MEASURES' and \
request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog)
return etree.fromstring("""
<return>
......
......@@ -302,10 +302,10 @@ class XmlaExecuteTools():
"""
columns_loop = []
if (len(mdx_execution_result['columns_desc']['columns'].keys()) == 0
) ^ (len(mdx_execution_result['columns_desc']['rows'].keys()) == 0):
if self.executer.facts in mdx_execution_result['columns_desc'][
'all'].keys():
if (
(len(mdx_execution_result['columns_desc']['columns'].keys()) == 0
) ^ (len(mdx_execution_result['columns_desc']['rows'].keys()) == 0)
) and self.executer.facts in mdx_execution_result['columns_desc']['all'].keys():
# iterate DataFrame horizontally
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