Commit ab2a5d44 authored by mouadh's avatar mouadh

format

parent f6879c40
......@@ -136,7 +136,8 @@ class MdxEngine:
config_file_parser = ConfigParser(self.cube_path)
tables = {}
if config_file_parser.config_file_exist(
) and self.cube in config_file_parser.get_cubes_names() and self.client != 'web':
) and self.cube in config_file_parser.get_cubes_names(
) and self.client != 'web':
for cubes in config_file_parser.construct_cubes():
# TODO working with cubes.source == 'csv'
......@@ -172,7 +173,8 @@ class MdxEngine:
config_file_parser = ConfigParser(self.cube_path)
if config_file_parser.config_file_exist(
self.client
) and self.cube in config_file_parser.get_cubes_names(client_type='web'):
) and self.cube in config_file_parser.get_cubes_names(
client_type='web'):
for cubes in config_file_parser.construct_cubes(self.client):
# TODO cubes.source == 'csv'
if cubes.source == 'postgres':
......@@ -262,9 +264,9 @@ class MdxEngine:
tup_att.replace('All ', '').replace('[', "").replace("]", "")
for tup_att in tup[0].replace('.Members', '').split('.')
]
for tup in re.compile(regex).findall(
query.encode("utf-8")[start:stop])
if len(tup[0].split('.')) > 1]
for tup in re.compile(regex).findall(
query.encode("utf-8")[start:stop])
if len(tup[0].split('.')) > 1]
# TODO temporary function
def decorticate_query(self, query):
......@@ -364,7 +366,7 @@ class MdxEngine:
else:
tables_columns.update({
tupl[0]:
self.tables_loaded[tupl[0]].columns[:len(tupl[2:])]
self.tables_loaded[tupl[0]].columns[:len(tupl[2:])]
})
axes.update({axis: tables_columns})
......
......@@ -220,14 +220,15 @@ class ConfigParser:
:return: True | False
"""
if self.config_file_exist():
with open(os.path.join(self.cube_path, self.file_name)) as config_file:
with open(os.path.join(self.cube_path,
self.file_name)) as config_file:
parser = etree.XMLParser()
tree = etree.parse(config_file, parser)
try:
return tree.xpath('/cubes/xmla_authentication')[
0].text == 'True'
0].text == 'True'
except:
return False
else:
......@@ -372,15 +373,16 @@ class ConfigParser:
Dashboard(
global_table={
'columns':
dashboard.find('Global_table/columns').text.split(','),
'rows': dashboard.find('Global_table/rows').text.split(',')
dashboard.find('Global_table/columns').text.split(','),
'rows':
dashboard.find('Global_table/rows').text.split(',')
},
pie_charts=dashboard.find('PieCharts').text.split(','),
bar_charts=dashboard.find('BarCharts').text.split(','),
line_charts={
table.find('name').text:
(table.find('columns').text.split(',')
if table.find('columns') is not None else 'ALL')
(table.find('columns').text.split(',')
if table.find('columns') is not None else 'ALL')
for table in dashboard.findall('LineCharts/table')
})
for dashboard in tree.xpath('/cubes/cube/Dashboards/Dashboard')
......
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