Hi,
maybe this is DAL.py error? Or more as one - strange behavior for dates in
czech/german format - 'date' fields in tables cannot be used at all (!!)
I have 'date' field in table 'akce' in SQLite database.
I try a) after removing SQLite database I try run appadmin and browse table
'akce'
b) after removing SQLite database I insert first record and
immediately I try select records using db().select(db.akce.ALL)
c) same as b) but after replacing 'date' field in table definition
with 'datetime'
2.3.2 stable:
a) http://localhost:8000/akce/appadmin/select/db?query=db.akce.id%3E0
appadmin fails with error message (1)-bellow
b) select fails with error message (2)-bellow
c) no error, but no row as select result (instead of proper one)
2.4.1 trunk (alpha.2 + timestamp.2013.01.10.21.26.18):
a) appadmin will not fail, however count of rows will not display (there is
'rows' instead of '0 rows' - in czech language)
b) select fails in same way as in 2.3.2 (message (2) !!!!)
c) select works fine for 'datetime' fields
I think at least in b) case, reason is german/czech date format, which
SQLite driver get from DAL.py.
Because
datetime.date(*map(int, val.split("-")))
works well for dates like val='2013-02-19'.
However sqlite3 driver will receive from DAL.py (func log_execute) the date
in local german/czech format like val='19.02.2013' and fails.
So field type 'date' in tables cannot be used at all !
Could this be repaired?
Thanks, Mirek
error (1) - I think this is fixed in trunk
File
"C:\Python27\Lib\site-packages\web2py\applications\akce\controllers/appadmin.py",
line 213, in select
nrows = db(query).count()
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 8896, in
count
return db._adapter.count(self.query,distinct)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 1652, in
count
return self.cursor.fetchone()[0]
TypeError: 'NoneType' object is not subscriptable
error (2) - for 'date' fields, not fixed yet
File "C:\Python27\Lib\site-packages\web2py\gluon\restricted.py", line
212, in restricted
exec ccode in environment
File
"C:/Python27/Lib/site-packages/web2py/applications/akce/controllers/akce.py",
line 47, in <module>
File "C:\Python27\Lib\site-packages\web2py\gluon\globals.py", line 193,
in <lambda>
self._caller = lambda f: f()
File
"C:/Python27/Lib/site-packages/web2py/applications/akce/controllers/akce.py",
line 7, in akce
db.akce.ALL, orderby=db.akce.sraz_kdy)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 9092, in
select
return adapter.select(self.query,fields,attributes)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 2178, in
select
return super(SQLiteAdapter, self).select(query, fields, attributes)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 1637, in
select
return self._select_aux(sql,fields,attributes)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 1602, in
_select_aux
self.execute(sql)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 1715, in
execute
return self.log_execute(*a, **b)
File "C:\Python27\Lib\site-packages\web2py\gluon\dal.py", line 1709, in
log_execute
ret = self.cursor.execute(*a, **b)
File "C:\Python27\lib\sqlite3\dbapi2.py", line 63, in convert_date
return datetime.date(*map(int, val.split("-")))
ValueError: invalid literal for int() with base 10: '19.02.2013'
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.