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
-~----------~----~----~----~------~----~------~--~---

Reply via email to