fix linter errors

This commit is contained in:
Leo Hemsted
2017-10-27 10:56:03 +01:00
parent 828c2de475
commit 0ea68f9c6d
4 changed files with 17 additions and 17 deletions

View File

@@ -506,7 +506,7 @@ class ServiceSmsSender(Form):
]
)
def validate_sms_sender(form, field):
def validate_sms_sender(self, field):
if field.data and not re.match(r'^[a-zA-Z0-9\s]+$', field.data):
raise ValidationError('Use letters and numbers only')
@@ -520,7 +520,7 @@ class ServiceLetterContactBlockForm(Form):
)
is_default = BooleanField("Set as your default address")
def validate_letter_contact_block(form, field):
def validate_letter_contact_block(self, field):
line_count = field.data.strip().count('\n')
if line_count >= 10:
raise ValidationError(

View File

@@ -80,7 +80,7 @@ def template_history(service_id):
months = [
{
'name': YYYY_MM_to_datetime(month).strftime('%B'),
'name': yyyy_mm_to_datetime(month).strftime('%B'),
'templates_used': aggregate_usage(
format_template_stats_to_list(stats.get(month)), sort_key='requested_count'
),
@@ -310,14 +310,14 @@ def format_monthly_stats_to_list(historical_stats):
return sorted((
dict(
date=key,
future=YYYY_MM_to_datetime(key) > datetime.utcnow(),
name=YYYY_MM_to_datetime(key).strftime('%B'),
future=yyyy_mm_to_datetime(key) > datetime.utcnow(),
name=yyyy_mm_to_datetime(key).strftime('%B'),
**aggregate_status_types(value)
) for key, value in historical_stats.items()
), key=lambda x: x['date'])
def YYYY_MM_to_datetime(string):
def yyyy_mm_to_datetime(string):
return datetime(int(string[0:4]), int(string[5:7]), 1)