From e468fba853e9d8ca79f017a95eacf7e86699e86b Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Fri, 9 Feb 2018 19:54:07 +0100 Subject: [PATCH] Fixes in mysql support --- paramecio/citoplasma/datetime.py | 7 +++++-- paramecio/cromosoma/databases/mysqldb.py | 4 ++-- paramecio/cromosoma/webmodel.py | 2 ++ paramecio/modules/admin/index.py | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/paramecio/citoplasma/datetime.py b/paramecio/citoplasma/datetime.py index c4a2e0f..0ed7880 100644 --- a/paramecio/citoplasma/datetime.py +++ b/paramecio/citoplasma/datetime.py @@ -205,13 +205,13 @@ def format_datetime(format_time, timeform, func_utc_return): # This method parse local time to gmt -def local_to_gmt(timeform): +def local_to_gmt(timeform, sql_format_time=sql_format_time): return format_datetime(sql_format_time, timeform, substract_utc) # time.localtime is useless, you need sum the time offset to the date -def gmt_to_local(timeform): +def gmt_to_local(timeform, sql_format_time=sql_format_time): return format_datetime(sql_format_time, timeform, sum_utc) @@ -287,6 +287,9 @@ def no_utc(timestamp): return arrow.get(timestamp) +# def date_to_sql(date_sql): + + class TimeClass: diff --git a/paramecio/cromosoma/databases/mysqldb.py b/paramecio/cromosoma/databases/mysqldb.py index c0aebed..a67128f 100644 --- a/paramecio/cromosoma/databases/mysqldb.py +++ b/paramecio/cromosoma/databases/mysqldb.py @@ -37,11 +37,11 @@ class SqlClass: SqlClass.mypool=pool.QueuePool(getconn, max_overflow=self.max_overflow, pool_size=self.pool_size, recycle=self.pool_recycle) self.conn=SqlClass.mypool.connect() + + self.conn.ping(True) while not self.conn.open: self.conn=SqlClass.mypool.connect() - - self.conn.ping(True) self.connected=True diff --git a/paramecio/cromosoma/webmodel.py b/paramecio/cromosoma/webmodel.py index a37e91c..67655a4 100644 --- a/paramecio/cromosoma/webmodel.py +++ b/paramecio/cromosoma/webmodel.py @@ -349,6 +349,8 @@ class WebModel: self.enctype=False + self.dummy=0 + # A method for add the connection def conn(self, sqlclass): diff --git a/paramecio/modules/admin/index.py b/paramecio/modules/admin/index.py index 7d8ca13..4a6a506 100644 --- a/paramecio/modules/admin/index.py +++ b/paramecio/modules/admin/index.py @@ -133,7 +133,7 @@ def home(module='', submodule='', t=t): except ValueError: t.env.directories.insert(num_template, templates_path) - print(t.env.directories) + # print(t.env.directories) #if config.reloader: #reload(new_module)