-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating to W2P 2.20+ Now All Edit Forms Return IS_NOT_IN_DB(Validator) Error String #632
Comments
Not 100% sure, but it appears that some recent changes caused validators to no longer support keyed tables |
I narrowed it down to this commit: I'm not familiar with why these changes were made or how to update them to support keyed tables. The only fix i've found is to roll back to the version of validators.py prior to this commit. |
Hello, This is an old issue not solved yet. I think it is an issue that comes from previous version. It has to do with IS_NOT_IN_DB validator and auth. It worked in web2py 2.17.2 version with no problem
This is the code of the controller where it breaks
It also fails in appadmin db.auth_user new record |
Any movement on this one? When updating a form that uses a radio widget we are seeing the same "Value not in database" error message whether the value has been changed or not. In db.py definition:
After submit if you print my_field in the controller it returns a list which the validator cannot handle:
instead of just 'y'. Any ideas why this is happening and how to fix it? If I remove the widget= statement from the field definition the problem goes away, but I'd really like to use the widget on my form (I have several). |
Originally submitted this issue to the web2py repo:
Describe the bug
Updated from 18.x to 20.2.x now causes ALL applications edit form submissions (a record UPDATE) to return error string "value already in database or empty" from class
IS_NOT_IN_DB(Validator)
of validator.py for custom PK'sTo Reproduce
Steps to reproduce the behavior:
Use W2P 2.18
Have unique PK in db.py. Example:
Field('request_uuid', 'string', length=36, default=uuid.uuid4(), notnull=True, unique=True, readable=False), primarykey=['request_uuid']
Create record.
Attempt to edit record.
Make, or do not make, changes to record via UI, hit submit, error string will be returned either way.
Interim Fix
Removing
unique=True
from field definition in db.py fixes the errorExpected behavior
Edit form submission should successfully UPDATE database as it did prior to W2P update to 2.20.
DAL field definition should use unique=True, where necessary, and not throw the error.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
There's been recent work on the class in question, based on search:
https://github.com/web2py/web2py/search?q=IS_NOT_IN_DB%28Validator&unscoped_q=IS_NOT_IN_DB%28Validator
The text was updated successfully, but these errors were encountered: