Fixzes in models
This commit is contained in:
parent
3c643f4a04
commit
3ad7d911b1
6 changed files with 29 additions and 14 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class SqlClass:
|
|||
self.connected=False
|
||||
self.pool_recycle=3600
|
||||
self.connect()
|
||||
self.last_query=''
|
||||
|
||||
|
||||
def connect(self):
|
||||
|
|
@ -139,6 +140,7 @@ class SqlClass:
|
|||
|
||||
cursor.execute(sql_query, arguments)
|
||||
self.conn.commit()
|
||||
self.last_query=cursor._last_executed
|
||||
return cursor
|
||||
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -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(' ', '')
|
||||
if value!=None:
|
||||
value=str(value)
|
||||
value=value.replace('-', '').replace(':', '').replace(' ', '')
|
||||
|
||||
return datetime.format_date(value)
|
||||
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'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
from paramecio.cromosoma.webmodel import WebModel, PhangoField
|
||||
import json
|
||||
|
||||
try:
|
||||
import ujson as json
|
||||
except:
|
||||
import json
|
||||
|
||||
class DictField(PhangoField):
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue