Re: [web2py] unique=True for time on sqlite

2014-07-09 Thread Anthony
Note, the pending patch makes the change only in the case of SQLite with date and time fields, so it will need to be altered to make the change universal. Anthony On Wednesday, July 9, 2014 8:12:01 AM UTC-4, Massimo Di Pierro wrote: > > Yes. It should be appended... I see there is a pending pat

Re: [web2py] unique=True for time on sqlite

2014-07-09 Thread Massimo Di Pierro
Yes. It should be appended... I see there is a pending patch. Will apply asap. On Tuesday, 8 July 2014 15:30:45 UTC-5, Anthony wrote: > > In DAL.sqlhtml_validators, we have: > > if field.unique: > requires.insert(0,validators.IS_NOT_IN_DB(db,field)) > > I wonder why IS_NOT_IN_DB is pr

Re: [web2py] unique=True for time on sqlite

2014-07-08 Thread Anthony
In DAL.sqlhtml_validators, we have: if field.unique: requires.insert(0,validators.IS_NOT_IN_DB(db,field)) I wonder why IS_NOT_IN_DB is prepended rather appended to the list of validators. Given that some of the validators may actually alter the value to be inserted (e.g., CRYPT, IS_

Re: [web2py] unique=True for time on sqlite

2014-07-08 Thread Paolo Valleri
I found the issue. Since the format of the date field (same happens for the time field) is a text in sqlite we must postpone to the validator IS_NOT_IN_DB the validator IS_DATE. By setting: db.user_table.birthday.requires=[IS_DATE(), IS_NOT_IN_DB(db, 'user_table.birthday')] everything works as e

Re: [web2py] unique=True for time on sqlite

2014-07-08 Thread Paolo Valleri
What is odd to me is that,on postgres the validator works as expected while on sqlite it doesn‘t and it is the backend itself that raises the exception. On Jul 8, 2014 6:43 PM, "Anthony" wrote: > Are you saying you want an error message to appear on the form? For that, > you need an IS_NOT_IN_DB

[web2py] unique=True for time on sqlite

2014-07-08 Thread Anthony
Are you saying you want an error message to appear on the form? For that, you need an IS_NOT_IN_DB validator, regardless of the database backend. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.goo

[web2py] unique=True for time on sqlite

2014-07-08 Thread Paolo Valleri
Hi all, I've tested the same example on both postgres and sqlite: def run(): db.define_table('user_table', Field('birthday', 'date', unique=True)) grid = SQLFORM.grid(db.user_table.id, user_signature=False) return {'grid':grid} The expected behavior is to get an error m