I'm having an issue (in my first real web2py application) whereby I'm unable to validate DB data via the DAL without creating a duplicate entry.
I have the following code in my db.py: db.define_table('ips', Field('id', 'id'), Field('ipaddress','string', length=15, unique=True), Field('dateadded', 'datetime', writable=False, readable=False, default=request.now), Field('reportedby', 'string', db.auth_user, writable=False, readable=False, default=auth.user.username if auth.user else ''), Field('updated', 'datetime', writable=False, readable=False, default=request.now), Field('attacknotes', 'text'), Field('b_or_w', 'string', length=1, widget=SQLFORM.widgets.radio.widget, requires=IS_IN_SET(['b','w']), default='b'), migrate=False) db.ips.ipaddress.requires = [IS_NOT_IN_DB(db, 'ips.ipaddress')] db.ips.ipaddress.requires.append(IS_IPV4()) This is in my default.py: def form_from_factory(): sample='' form = SQLFORM.factory(Field('data', 'text', requires=IS_NOT_EMPTY())) if form.process(session=None, onvalidation=validate_form).accepted: session.data = form.vars.data.split() x = '192.168.0.1' db.ips.reportedby.default="formtest" db.ips.dateadded.default=request.now db.ips.updated.default=request.now db.ips.ipaddress.requires = [IS_NOT_IN_DB(db, x)] session.flash = x#'accepted' redirect(URL('test')) return dict(form=form) I'm entering a list of IP addresses that get verified and, if valid, need to be input into the database. With the test code you see above, I can create any number of entries that all have '192.168.0.1' even though I've specified the ipaddress in my DAL to be unique. HELP!