Commit ab2a5d44 authored by mouadh's avatar mouadh

format

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