Skip to content

Commit

Permalink
Add new file_uri validator
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalresistor committed Feb 1, 2019
1 parent 7ccafc2 commit 1a17b23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions colander/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,18 @@ def _luhnok(value):

url = Regex(URL_REGEX, msg=_('Must be a URL'), flags=re.IGNORECASE)


URI_REGEX = (
# file:// (required)
r'^file://'
# Path
r'(?:/|[/?]\S+)$'
)

file_uri = Regex(
URI_REGEX, msg=_('Must be a file:// URI scheme'), flags=re.IGNORECASE
)

UUID_REGEX = (
r'^(?:urn:uuid:)?\{?[a-f0-9]{8}(?:-?[a-f0-9]{4}){3}-?[a-f0-9]{12}\}?$'
)
Expand Down

0 comments on commit 1a17b23

Please sign in to comment.