[web2py] Re: Why aren't email/username fields unique?

2013-02-10 Thread Massimo Di Pierro
All the code about Auth is in gluon/tools.py. True we do not check at the db level but we check at the web2py level: Field('email', length=512, default='', label=self.messages.label_email, requires=is_unique_email), On Sunday, 10 February

[web2py] Re: Why aren't email/username fields unique?

2013-02-10 Thread Anthony
The code is here: http://code.google.com/p/web2py/source/browse/gluon/tools.py#1452 Uniqueness is checked via the form validators rather than unique=True (which is enforced at the database level). The validators are more useful because they display a user friendly error message on the form

Re: [web2py] Re: Why aren't email/username fields unique?

2013-02-10 Thread Yarin Kessler
Agree that is should be caught by validation- but why not enforce uniqueness on the DB as well to prevent data corruption in case the db gets hit by another source/ edited manually/ etc. Why have DB-level constraints if we don't use them in cases like this? On Sun, Feb 10, 2013 at 11:31 AM,

Re: [web2py] Re: Why aren't email/username fields unique?

2013-02-10 Thread Massimo Di Pierro
Because it migrations involving uniqueness are tricky and this change may break existing applications. Moreover there are cases when people do not want the email to be unique, for example if they also have a username. On Sunday, 10 February 2013 16:34:12 UTC-6, Yarin wrote: Agree that is