This repository has been archived by the owner on Sep 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
350 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
Changelog | ||
--------- | ||
|
||
- Adds a phone number validator. | ||
[msom] | ||
|
||
0.35.0 (2018-09-12) | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# | ||
# Italian translations for PACKAGE package | ||
# Traduzioni italiane per il pacchetto PACKAGE. | ||
# This file is distributed under the same license as the PACKAGE package. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE 1.0\n" | ||
"POT-Creation-Date: 2018-09-18 15:53+0200\n" | ||
"PO-Revision-Date: 2018-09-18 15:45+0200\n" | ||
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n" | ||
"Language-Team: Italian\n" | ||
"Language: it_CH\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Lingua 3.12\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
||
msgid "Required" | ||
msgstr "" | ||
|
||
msgid "Optional" | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "The file is too large, please provide a file smaller than {}." | ||
msgstr "" | ||
|
||
msgid "Files of this type are not supported." | ||
msgstr "" | ||
|
||
msgid "The form could not be parsed." | ||
msgstr "" | ||
|
||
msgid "Define at least one required e-mail field ('E-Mail * = @@@')" | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "The syntax on line {line} is not valid." | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "The field '{label}' exists more than once." | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "'{label}' is a reserved name. Please use a different name." | ||
msgstr "" | ||
|
||
msgid "Not a valid phone number." | ||
msgstr "Non è un numero di telefono valido." | ||
|
||
msgid "Uploaded file" | ||
msgstr "" | ||
|
||
msgid "Keep file" | ||
msgstr "" | ||
|
||
msgid "Delete file" | ||
msgstr "" | ||
|
||
msgid "Replace file" | ||
msgstr "" | ||
|
||
msgid "General" | ||
msgstr "" | ||
|
||
msgid "Title" | ||
msgstr "" | ||
|
||
msgid "Text" | ||
msgstr "" | ||
|
||
msgid "Multiline" | ||
msgstr "" | ||
|
||
msgid "E-Mail" | ||
msgstr "" | ||
|
||
msgid "Website" | ||
msgstr "" | ||
|
||
msgid "Date and time" | ||
msgstr "" | ||
|
||
msgid "Date" | ||
msgstr "" | ||
|
||
msgid "Time" | ||
msgstr "" | ||
|
||
msgid "Choices" | ||
msgstr "" | ||
|
||
msgid "Choice" | ||
msgstr "" | ||
|
||
msgid "Multiple Choice" | ||
msgstr "" | ||
|
||
msgid "Files" | ||
msgstr "" | ||
|
||
msgid "Image" | ||
msgstr "" | ||
|
||
msgid "Document" | ||
msgstr "" | ||
|
||
msgid "Numbers" | ||
msgstr "" | ||
|
||
msgid "Age" | ||
msgstr "" | ||
|
||
msgid "Percentage" | ||
msgstr "" | ||
|
||
msgid "Extended" | ||
msgstr "" | ||
|
||
msgid "IBAN" | ||
msgstr "" | ||
|
||
msgid "Swiss social security number" | ||
msgstr "" | ||
|
||
msgid "Swiss business identifier" | ||
msgstr "" | ||
|
||
msgid "Swiss vat number" | ||
msgstr "" | ||
|
||
msgid "Markdown" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# | ||
# Romansh translations for PACKAGE package | ||
# This file is distributed under the same license as the PACKAGE package. | ||
# Marc Sommerhalder <marc.sommerhalder@seantis.c>, 2018. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE 1.0\n" | ||
"POT-Creation-Date: 2018-09-18 15:53+0200\n" | ||
"PO-Revision-Date: 2017-06-28 12:03+0200\n" | ||
"Last-Translator: Marc Sommerhalder <marc.sommerhalder@seantis.ch>\n" | ||
"Language-Team: Romansh\n" | ||
"Language: rm\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Lingua 3.12\n" | ||
"X-Generator: Poedit 2.0.2\n" | ||
|
||
msgid "Required" | ||
msgstr "" | ||
|
||
msgid "Optional" | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "The file is too large, please provide a file smaller than {}." | ||
msgstr "" | ||
|
||
msgid "Files of this type are not supported." | ||
msgstr "" | ||
|
||
msgid "The form could not be parsed." | ||
msgstr "" | ||
|
||
msgid "Define at least one required e-mail field ('E-Mail * = @@@')" | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "The syntax on line {line} is not valid." | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "The field '{label}' exists more than once." | ||
msgstr "" | ||
|
||
#, python-format | ||
msgid "'{label}' is a reserved name. Please use a different name." | ||
msgstr "" | ||
|
||
msgid "Not a valid phone number." | ||
msgstr "Numer da telefon nunvalaivel." | ||
|
||
msgid "Uploaded file" | ||
msgstr "" | ||
|
||
msgid "Keep file" | ||
msgstr "" | ||
|
||
msgid "Delete file" | ||
msgstr "" | ||
|
||
msgid "Replace file" | ||
msgstr "" | ||
|
||
msgid "General" | ||
msgstr "" | ||
|
||
msgid "Title" | ||
msgstr "" | ||
|
||
msgid "Text" | ||
msgstr "" | ||
|
||
msgid "Multiline" | ||
msgstr "" | ||
|
||
msgid "E-Mail" | ||
msgstr "" | ||
|
||
msgid "Website" | ||
msgstr "" | ||
|
||
msgid "Date and time" | ||
msgstr "" | ||
|
||
msgid "Date" | ||
msgstr "" | ||
|
||
msgid "Time" | ||
msgstr "" | ||
|
||
msgid "Choices" | ||
msgstr "" | ||
|
||
msgid "Choice" | ||
msgstr "" | ||
|
||
msgid "Multiple Choice" | ||
msgstr "" | ||
|
||
msgid "Files" | ||
msgstr "" | ||
|
||
msgid "Image" | ||
msgstr "" | ||
|
||
msgid "Document" | ||
msgstr "" | ||
|
||
msgid "Numbers" | ||
msgstr "" | ||
|
||
msgid "Age" | ||
msgstr "" | ||
|
||
msgid "Percentage" | ||
msgstr "" | ||
|
||
msgid "Extended" | ||
msgstr "" | ||
|
||
msgid "IBAN" | ||
msgstr "" | ||
|
||
msgid "Swiss social security number" | ||
msgstr "" | ||
|
||
msgid "Swiss business identifier" | ||
msgstr "" | ||
|
||
msgid "Swiss vat number" | ||
msgstr "" | ||
|
||
msgid "Markdown" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from onegov.form.validators import ValidPhoneNumber | ||
from pytest import raises | ||
from wtforms.validators import ValidationError | ||
|
||
|
||
def test_phone_number_validator(): | ||
|
||
class Field(object): | ||
def __init__(self, data): | ||
self.data = data | ||
|
||
validator = ValidPhoneNumber() | ||
|
||
validator(None, Field(None)) | ||
validator(None, Field('')) | ||
|
||
validator(None, Field('+41791112233')) | ||
validator(None, Field('0041791112233')) | ||
validator(None, Field('0791112233')) | ||
|
||
with raises(ValidationError): | ||
validator(None, Field(1234)) | ||
with raises(ValidationError): | ||
validator(None, Field('1234')) | ||
|
||
with raises(ValidationError): | ||
validator(None, Field('+417911122333')) | ||
with raises(ValidationError): | ||
validator(None, Field('041791112233')) | ||
with raises(ValidationError): | ||
validator(None, Field('041791112233')) | ||
with raises(ValidationError): | ||
validator(None, Field('00791112233')) |
Oops, something went wrong.