~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to wiki/forms.py

  • Committer: franku
  • Date: 2016-12-13 18:28:51 UTC
  • mto: This revision was merged to the branch mainline in revision 443.
  • Revision ID: somal@arcor.de-20161213182851-bo5ebf8pdvw5beua
run the script

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                   'group', 'created_at', 'last_update')
35
35
 
36
36
    def clean_title(self):
37
 
        """ Page title must be a WikiWord.
38
 
        """
 
37
        """Page title must be a WikiWord."""
39
38
        title = self.cleaned_data['title']
40
39
        if not wikiword_pattern.match(title):
41
40
            raise forms.ValidationError(_('Must be a WikiWord.'))
52
51
                kw['content_type'] = self.cleaned_data['content_type']
53
52
                kw['object_id'] = self.cleaned_data['object_id']
54
53
            except KeyError:
55
 
                pass # some error in this fields
 
54
                pass  # some error in this fields
56
55
            else:
57
56
                if Article.objects.filter(**kw).count():
58
57
                    raise forms.ValidationError(
59
 
                        _("An article with this title already exists."))
 
58
                        _('An article with this title already exists.'))
60
59
 
61
60
        return self.cleaned_data
62
61
 
94
93
            comment, editor_ip, editor)
95
94
 
96
95
        return article, changeset
97