Skip to content

Allow for arbitrary delimiters in DelimitedDigitsPostalCode validator.#125

Merged
lambacck merged 1 commit into
formencode:masterfrom
edelooff:flexible-postal-code-delimiters
Feb 4, 2017
Merged

Allow for arbitrary delimiters in DelimitedDigitsPostalCode validator.#125
lambacck merged 1 commit into
formencode:masterfrom
edelooff:flexible-postal-code-delimiters

Conversation

@edelooff
Copy link
Copy Markdown
Contributor

As per the subject, this alters the DelimitedDigitsPostalCode class to accept postal codes with arbitrary (wrong) delimiters in the input. The grouping and delimiter are used for output grouping, but the input is solely verified by its digit content.

This behavior is at least already partially supported, where delimiters in input are optional, so this is an extension on that. The code still builds up a regex which is then verified against, but at this point it might make more sense to just use re.findall() to get the digits and check for the correct count if the strict parameter is provided.

I'm happy to make changes if you like that approach better.

@edelooff
Copy link
Copy Markdown
Contributor Author

FYI, tests fail due API changes introduced in the new series of pycountry, #124 resolves that :)

@lambacck
Copy link
Copy Markdown
Contributor

Needs merge from master to make tests pass.

@edelooff edelooff force-pushed the flexible-postal-code-delimiters branch from ec87055 to 37b41a8 Compare January 25, 2017 09:55
@edelooff
Copy link
Copy Markdown
Contributor Author

All good now.

@edelooff
Copy link
Copy Markdown
Contributor Author

Hi @lambacck, any chance you could merge this in and push a new (alpha?) release to PyPI?

@lambacck lambacck merged commit 824133a into formencode:master Feb 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants