summaryrefslogtreecommitdiffstats
path: root/askbot/utils/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'askbot/utils/forms.py')
-rw-r--r--askbot/utils/forms.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/askbot/utils/forms.py b/askbot/utils/forms.py
index 6c3af066..6f57f71f 100644
--- a/askbot/utils/forms.py
+++ b/askbot/utils/forms.py
@@ -47,6 +47,18 @@ def get_db_object_or_404(params):
#need catch-all b/c of the nature of the function
raise Http404
+def format_errors(error_list):
+ """If there is only one error - returns a string
+ corresponding to that error, to remove the <ul> tag.
+
+ If there is > 1 error - then convert the error_list into
+ a string.
+ """
+ if len(error_list) == 1:
+ return unicode(error_list[0])
+ else:
+ return unicode(error_list)
+
class StrippedNonEmptyCharField(forms.CharField):
def clean(self, value):
value = value.strip()