Fixzes in models

This commit is contained in:
Antonio de la Rosa 2021-03-22 00:09:30 +01:00
parent 3c643f4a04
commit 3ad7d911b1
6 changed files with 29 additions and 14 deletions

View file

@ -151,10 +151,10 @@ def obtain_timestamp(timeform, local=False, tz=''):
t=arrow.arrow.Arrow(y, m, d, h, mi, s).to(tz)
timestamp=t.timestamp
timestamp=t.timestamp()
else:
timestamp=arrow.arrow.Arrow(y, m, d, h, mi, s).timestamp
timestamp=arrow.arrow.Arrow(y, m, d, h, mi, s).timestamp()
return timestamp
@ -425,7 +425,7 @@ class TimeClass:
if checkdatetime(y, m, d, h, mi, s):
timestamp=arrow.arrow.Arrow(y, m, d, h, mi, s).timestamp
timestamp=arrow.arrow.Arrow(y, m, d, h, mi, s).timestamp()
return timestamp

View file

@ -18,7 +18,11 @@ except:
from itsdangerous import JSONWebSignatureSerializer
from bottle import request, response
import os
import json
try:
import ujson as json
except:
import json
import fcntl
import errno
import time

View file

@ -29,6 +29,7 @@ class SqlClass:
self.connected=False
self.pool_recycle=3600
self.connect()
self.last_query=''
def connect(self):
@ -138,7 +139,8 @@ class SqlClass:
try:
cursor.execute(sql_query, arguments)
self.conn.commit()
self.conn.commit()
self.last_query=cursor._last_executed
return cursor
except:

View file

@ -24,13 +24,13 @@ class DateTimeField(PhangoField):
self.error=True
self.txt_error=self.error_default
return ''
return None
if value==False:
self.error=True
self.txt_error=self.error_default
return ''
return None
else:
"""
@ -46,10 +46,14 @@ class DateTimeField(PhangoField):
def show_formatted(self, value):
# Convert to paramecio value
value=str(value)
value=value.replace('-', '').replace(':', '').replace(' ', '')
return datetime.format_date(value)
if value!=None:
value=str(value)
value=value.replace('-', '').replace(':', '').replace(' ', '')
return datetime.format_date(value)
else:
return ''
def get_type_sql(self):
@ -57,4 +61,4 @@ class DateTimeField(PhangoField):
"""
return 'DATETIME NOT NULL'
return 'DATETIME NULL'

View file

@ -1,5 +1,9 @@
from paramecio.cromosoma.webmodel import WebModel, PhangoField
import json
try:
import ujson as json
except:
import json
class DictField(PhangoField):

View file

@ -471,7 +471,8 @@ class WebModel:
except:
self.query_error='Cannot insert the new row'
print(sys.exc_info()[0])
return False
raise
#return False
c=len(values)