Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@TurnrDev
Copy link

@TurnrDev TurnrDev commented Feb 9, 2023

Fixes #549 and pallets-eco/flask-admin#1444

Better implementation of #609

Also, account for uuid.UUID raising TypeErrors
@TurnrDev TurnrDev marked this pull request as ready for review February 9, 2023 16:28
@TurnrDev TurnrDev marked this pull request as draft February 9, 2023 16:37
@TurnrDev TurnrDev marked this pull request as ready for review February 9, 2023 16:42
@TurnrDev
Copy link
Author

TurnrDev commented Feb 9, 2023

Test Result:

================================================= test session starts =================================================
platform win32 -- Python 3.10.2, pytest-7.2.1, pluggy-1.0.0 -- C:\Users\JayTurner\.virtualenvs\wtforms-V-P53RkO\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\JayTurner\Personal\wtforms, configfile: setup.cfg
collected 7 items

tests/validators/test_uuid.py::test_valid_uuid_passes[2bc1c94f-0deb-43e9-92a1-4775189ec9f8] PASSED               [ 14%]
tests/validators/test_uuid.py::test_valid_uuid_passes[2bc1c94f0deb43e992a14775189ec9f8] PASSED                   [ 28%]
tests/validators/test_uuid.py::test_valid_uuid_passes[uuid_val2] PASSED                                          [ 42%]
tests/validators/test_uuid.py::test_bad_uuid_raises[2bc1c94f-deb-43e9-92a1-4775189ec9f8] PASSED                  [ 57%]
tests/validators/test_uuid.py::test_bad_uuid_raises[2bc1c94f-0deb-43e9-92a1-4775189ec9f] PASSED                  [ 71%]
tests/validators/test_uuid.py::test_bad_uuid_raises[gbc1c94f-0deb-43e9-92a1-4775189ec9f8] PASSED                 [ 85%]
tests/validators/test_uuid.py::test_bad_uuid_raises[2bc1c94f 0deb-43e9-92a1-4775189ec9f8] PASSED                 [100%]

================================================== 7 passed in 0.02s ==================================================

@TurnrDev
Copy link
Author

I have reformted the imports on re the tox style checks and added a changelog entry

@azmeuk azmeuk added the enhancement New feature, or existing feature improvement label Jul 22, 2023
@azmeuk
Copy link
Member

azmeuk commented Oct 9, 2023

Hi @TurnrDev
I was thinking about this PR and I was wondering: if the validator gets UUID objects in the end, that means that it has been initialized (with model data for instance), and it has been validated without formdata (else the formdata would have been validated, and formdata can only be strings). Out of curiosity, why do you validate your model data?

@TurnrDev
Copy link
Author

TurnrDev commented Oct 9, 2023

Hi @azmeuk

I encoured this issue when using flask-admin with sqlalchemy. I can't say for sure why they're doing what they're doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, or existing feature improvement

Development

Successfully merging this pull request may close these issues.

UUID validator fails if field.data is a UUID object instead of str

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.