It seems that it is failing because unique=True and there is already a Null value inserted.
Would you suggest using unique=True, or IS_NOT_IN_DB() ? -Thadeus On Mon, Oct 19, 2009 at 6:20 PM, mdipierro <[email protected]> wrote: > > this is a database issue, not a web2py. This is why I often use > requires=IS_NOT_EMPTY() instead of notnull=True. > > Massimo > > On Oct 19, 5:09 pm, Thadeus Burgess <[email protected]> wrote: > > Starting from a fresh sqlite database, I am attempting to import 3k+ > records > > from a custom csv file (not one generated by web2py) > > > > Each row, I validate the input from the file before insertion to the > > database. If I have incorrect input I throw an exception, basically > passing > > the row from being inserted to the database. > > > > email = row['Email'].lower() > > > > email, error = IS_EMAIL()(email) > > > > if error and email != "": > > email = "" > > > > email, error = IS_NOT_IN_DB(db, 'participant.email')(email) > > > > if error and email != "": > > raise Exception('Duplicated Email!!! {{{%s}}}' % > > row['Email']) > > > > At the end, i go db.user.insert(email=email, name=name, etc=etc) > > > > The problem I am having, is email in the database declaration has > > unique=True, and is triggering an exception when there is no email. > > > > New users to this system will always have an email, and it will always be > > unique, but unfortunately, old users may not have emails, but must still > > remain in the system until they give an email. > > > > Is the only solution to this problem not setting the Field to unique? > > > > -Thadeus > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

