From 54891e1576a3b8ad96fcfa159c5eaf5ab9cd2446 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sat, 4 May 2013 23:08:48 -0400 Subject: small change in the PostAsSomeone form --- askbot/forms.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'askbot') diff --git a/askbot/forms.py b/askbot/forms.py index 1ef8cefa..04efb1f3 100644 --- a/askbot/forms.py +++ b/askbot/forms.py @@ -868,16 +868,16 @@ class PostAsSomeoneForm(forms.Form): todo: maybe better to have field where initial value is invalid, then we would not have to have two almost identical clean functions? """ - username = self.cleaned_data.get('post_author_username', '') + username = self.cleaned_data.get('post_author_username', '').strip() initial_username = unicode(self.fields['post_author_username'].initial) - if username == initial_username: + if username and username == initial_username: self.cleaned_data['post_author_username'] = '' return self.cleaned_data['post_author_username'] def clean_post_author_email(self): """if value is the same as initial, it is reset to empty string""" - email = self.cleaned_data.get('post_author_email', '') + email = self.cleaned_data.get('post_author_email', '').strip() initial_email = unicode(self.fields['post_author_email'].initial) if email == initial_email: email = '' -- cgit v1.2.3-1-g7c22