1 # GNU MediaGoblin -- federated, autonomous media hosting
2 # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 from mediagoblin
.tools
.text
import tag_length_validator
, TOO_LONG_TAG_WARNING
20 from mediagoblin
.tools
.translate
import fake_ugettext_passthrough
as _
21 from mediagoblin
.tools
.licenses
import licenses_as_choices
23 class EditForm(wtforms
.Form
):
24 title
= wtforms
.TextField(
26 [wtforms
.validators
.Length(min=0, max=500)])
27 description
= wtforms
.TextAreaField(
28 _('Description of this work'),
29 description
=_("""You can use
30 <a href="http://daringfireball.net/projects/markdown/basics">
31 Markdown</a> for formatting."""))
32 tags
= wtforms
.TextField(
34 [tag_length_validator
],
36 "Separate tags by commas."))
37 slug
= wtforms
.TextField(
39 [wtforms
.validators
.Required(message
=_("The slug can't be empty"))],
41 "The title part of this media's address. "
42 "You usually don't need to change this."))
43 license
= wtforms
.SelectField(
45 [wtforms
.validators
.Optional(),],
46 choices
=licenses_as_choices())
48 class EditProfileForm(wtforms
.Form
):
49 bio
= wtforms
.TextAreaField(
51 [wtforms
.validators
.Length(min=0, max=500)],
52 description
=_("""You can use
53 <a href="http://daringfireball.net/projects/markdown/basics">
54 Markdown</a> for formatting."""))
55 url
= wtforms
.TextField(
57 [wtforms
.validators
.Optional(),
58 wtforms
.validators
.URL(message
="""This address contains errors""")])
61 class EditAccountForm(wtforms
.Form
):
62 old_password
= wtforms
.PasswordField(
64 [wtforms
.validators
.Required()],
66 "Enter your old password to prove you own this account."))
67 new_password
= wtforms
.PasswordField(
69 [wtforms
.validators
.Required(),
70 wtforms
.validators
.Length(min=6, max=30)],
74 class EditAttachmentsForm(wtforms
.Form
):
75 attachment_name
= wtforms
.TextField(
77 attachment_file
= wtforms
.FileField(