Commit d498a0b3 authored by mouadh's avatar mouadh

remove try catch

parent 44a31ef6
...@@ -16,12 +16,7 @@ class MyDB(object): ...@@ -16,12 +16,7 @@ class MyDB(object):
# raise Exception('Missing database config file') # raise Exception('Missing database config file')
def __init__(self, def __init__(self,db=None):
username='postgres',
password='root',
db=None,
host='localhost'
):
# TODO temporary # TODO temporary
db_config = DbConfigParser() db_config = DbConfigParser()
...@@ -31,10 +26,11 @@ class MyDB(object): ...@@ -31,10 +26,11 @@ class MyDB(object):
host = db_credentials['host'] host = db_credentials['host']
if db is None: if db is None:
# first i want to show all databases to user (in excel)
self.connection = pg.connect("user={0} password={1} host='{2}'". self.connection = pg.connect("user={0} password={1} host='{2}'".
format(username, password, host)) format(username, password, host))
else: else:
# and then we connect to the user db
try: try:
self.connection = pg.connect( self.connection = pg.connect(
"user={0} password={1} dbname='{2}' host='{3}'".format( "user={0} password={1} dbname='{2}' host='{3}'".format(
......
...@@ -89,13 +89,10 @@ else: ...@@ -89,13 +89,10 @@ else:
home_directory = expanduser("~") home_directory = expanduser("~")
if not os.path.isdir(os.path.join(home_directory, 'olapy-data', 'cubes')): if not os.path.isdir(os.path.join(home_directory, 'olapy-data', 'cubes')):
try: os.makedirs(os.path.join(home_directory, 'olapy-data', 'cubes'))
os.makedirs(os.path.join(home_directory, 'olapy-data', 'cubes')) zip_ref = zipfile.ZipFile('cubes_templates/cubes_temp.zip', 'r')
zip_ref = zipfile.ZipFile('cubes_templates/cubes_temp.zip', 'r') zip_ref.extractall(os.path.join(home_directory, 'olapy-data', 'cubes'))
zip_ref.extractall(os.path.join(home_directory, 'olapy-data', 'cubes')) zip_ref.close()
zip_ref.close()
except:
raise Exception('unable to create cubes directory !')
if not os.path.isfile(os.path.join(home_directory, 'olapy-data','olapy-config.xml')): if not os.path.isfile(os.path.join(home_directory, 'olapy-data','olapy-config.xml')):
copyfile('config/olapy-config.xml', os.path.join(home_directory, 'olapy-data','olapy-config.xml')) copyfile('config/olapy-config.xml', os.path.join(home_directory, 'olapy-data','olapy-config.xml'))
......
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