error when users put non-GSM chars in a sms template

additionally, this moves the formatted_list jinja macro into a python
function, so that it can be called from the form validator
This commit is contained in:
Leo Hemsted
2017-02-13 13:11:29 +00:00
parent cb54db82b4
commit 41fa158635
6 changed files with 51 additions and 52 deletions

View File

@@ -23,7 +23,7 @@ from wtforms import (
from wtforms.fields.html5 import EmailField, TelField
from wtforms.validators import (DataRequired, Email, Length, Regexp, Optional)
from app.main.validators import (Blacklist, CsvFileValidator, ValidGovEmail, NoCommasInPlaceHolders)
from app.main.validators import (Blacklist, CsvFileValidator, ValidGovEmail, NoCommasInPlaceHolders, OnlyGSMCharacters)
def get_time_value_and_label(future_time):
@@ -260,7 +260,8 @@ class SMSTemplateForm(Form):
u'Message',
validators=[
DataRequired(message="Cant be empty"),
NoCommasInPlaceHolders()
NoCommasInPlaceHolders(),
OnlyGSMCharacters()
]
)
process_type = RadioField(