diff --git a/zine/forms.py b/zine/forms.py
|
a
|
b
|
|
| 10 | 10 | """ |
| 11 | 11 | from copy import copy |
| 12 | 12 | from datetime import datetime |
| | 13 | from itertools import chain |
| 13 | 14 | import os |
| 14 | 15 | |
| 15 | 16 | from zine.i18n import _, lazy_gettext, list_languages |
| … |
… |
|
| 155 | 156 | is not a post req or the form is invalid the return value is None, |
| 156 | 157 | otherwise a redirect response to the new comment. |
| 157 | 158 | """ |
| 158 | | if req.method != 'POST' or not self.validate(req.form): |
| | 159 | if req.method != 'POST': |
| | 160 | return |
| | 161 | |
| | 162 | valid = self.validate(req.form) |
| | 163 | |
| | 164 | errors = emit_event('before-comment-created', req) |
| | 165 | errors = filter(lambda x: x is not None, errors) |
| | 166 | errors = list(chain(*errors)) |
| | 167 | |
| | 168 | if len(errors) > 0: |
| | 169 | # update the form-wide error list with those added by the |
| | 170 | # event handlers |
| | 171 | error_list = self.errors.get(None, forms.ErrorList()) |
| | 172 | error_list.extend(errors) |
| | 173 | self.errors[None] = error_list |
| | 174 | return |
| | 175 | |
| | 176 | if not valid: |
| 159 | 177 | return |
| 160 | 178 | |
| 161 | 179 | # if we don't have errors let's save it and emit an |