> > A followup question. The reason I need my clumsy >>> customized_email_verification() in the first place, is because I seemingly >>> have to do db.commit() BEFORE the time consuming email sending job. >>> Otherwise I saw some randomly duplicated records in my auth_user table. I >>> don't know the exact reason but my guess is, the tools.py's define_tables() >>> uses IS_NOT_IN_DB() validators which only work in web2py level, but does >>> NOT define any "unique=True" in the DB level. Is this considered as a >>> defect? >>> >> >> It's not a defect, just something you have to handle properly in your >> code. You can separately set the unique=True argument when creating the >> model, and that will be enforced by the database, >> > > I know I can always define my OTHER tables properly. But now we are > talking about the web2py built-in auth_user table. Do I have to redefine > them in my models/db.py EVERY TIME I start a new project? That doesn't > sound right. Is there any reason we don't want to do that inside > gluon/tools.py? >
I think you should be able to set the "unique" attribute of individual fields after the table has been defined, so you shouldn't need to re-define the entire table. I don't think we want to set that attribute in tools.py because we would then need a mechanism for catching database errors that might be generated. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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/d/optout.

