From fe9c8282d9f90a353d5dc75627104ef8cf550b3b Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Mon, 25 Feb 2013 15:41:34 -0500 Subject: [PATCH] Only verify field if field is not null. --- snipts/api.py | 5 +++-- templates/analytics.html | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/snipts/api.py b/snipts/api.py index 7440a5f..3cd87c7 100644 --- a/snipts/api.py +++ b/snipts/api.py @@ -41,8 +41,9 @@ class UserProfileValidation(Validation): return 'You must be a Pro to change these settings.' for field in bundle.data: - if not re.match('^[ A-Za-z0-9\/\@\._-]*$', bundle.data[field]): - errors[field] = 'Only spaces, letters, numbers, underscores, dashes, periods, forward slashes, and "at sign" are valid.' + if bundle.data[field]: + if not re.match('^[ A-Za-z0-9\/\@\._-]*$', bundle.data[field]): + errors[field] = 'Only spaces, letters, numbers, underscores, dashes, periods, forward slashes, and "at sign" are valid.' return errors diff --git a/templates/analytics.html b/templates/analytics.html index 45dd880..8bc9dfc 100644 --- a/templates/analytics.html +++ b/templates/analytics.html @@ -1,4 +1,4 @@ - +{% if not debug %} {% endif %} - {% if debug %} - - {% endif %} +{% else %} + +{% endif %}