import wtforms
+from mediagoblin.util import pass_to_ugettext as _
+
class RegistrationForm(wtforms.Form):
username = wtforms.TextField(
- 'Username',
+ _('Username'),
[wtforms.validators.Required(),
wtforms.validators.Length(min=3, max=30),
wtforms.validators.Regexp(r'^\w+$')])
password = wtforms.PasswordField(
- 'Password',
+ _('Password'),
[wtforms.validators.Required(),
wtforms.validators.Length(min=6, max=30),
wtforms.validators.EqualTo(
'confirm_password',
- 'Passwords must match.')])
+ _('Passwords must match.'))])
confirm_password = wtforms.PasswordField(
- 'Confirm password',
+ _('Confirm password'),
[wtforms.validators.Required()])
email = wtforms.TextField(
- 'Email address',
+ _('Email address'),
[wtforms.validators.Required(),
wtforms.validators.Email()])
class LoginForm(wtforms.Form):
username = wtforms.TextField(
- 'Username',
+ _('Username'),
[wtforms.validators.Required(),
wtforms.validators.Regexp(r'^\w+$')])
password = wtforms.PasswordField(
- 'Password',
+ _('Password'),
[wtforms.validators.Required()])
from mediagoblin import messages
from mediagoblin import mg_globals
from mediagoblin.util import render_to_response, redirect
+from mediagoblin.util import pass_to_ugettext as _
from mediagoblin.db.util import ObjectId
from mediagoblin.auth import lib as auth_lib
from mediagoblin.auth import forms as auth_forms
messages.add_message(
request,
messages.WARNING,
- ('Sorry, registration is disabled on this instance.'))
+ _('Sorry, registration is disabled on this instance.'))
return redirect(request, "index")
register_form = auth_forms.RegistrationForm(request.POST)
if users_with_username:
register_form.username.errors.append(
- u'Sorry, a user with that name already exists.')
+ _(u'Sorry, a user with that name already exists.'))
else:
# Create the user
messages.add_message(
request,
messages.SUCCESS,
- ('Your email address has been verified. '
- 'You may now login, edit your profile, and submit images!'))
+ _("Your email address has been verified. "
+ "You may now login, edit your profile, and submit images!"))
else:
- messages.add_message(request,
- messages.ERROR,
- 'The verification key or user id is incorrect')
+ messages.add_message(
+ request,
+ messages.ERROR,
+ _('The verification key or user id is incorrect'))
return redirect(
request, 'mediagoblin.user_pages.user_home',
messages.add_message(
request,
messages.INFO,
- 'Resent your verification email.')
+ _('Resent your verification email.'))
return redirect(
request, 'mediagoblin.user_pages.user_home',
user=request.user['username'])
import wtforms
+
from mediagoblin.util import tag_length_validator, TOO_LONG_TAG_WARNING
+from mediagoblin.util import pass_to_ugettext as _
class EditForm(wtforms.Form):
title = wtforms.TextField(
- 'Title',
+ _('Title'),
[wtforms.validators.Length(min=0, max=500)])
slug = wtforms.TextField(
- 'Slug',
- [wtforms.validators.Required(message="The slug can't be empty")])
+ _('Slug'),
+ [wtforms.validators.Required(message=_("The slug can't be empty"))])
description = wtforms.TextAreaField('Description of this work')
tags = wtforms.TextField(
- 'Tags',
+ _('Tags'),
[tag_length_validator])
class EditProfileForm(wtforms.Form):
- bio = wtforms.TextAreaField('Bio',
+ bio = wtforms.TextAreaField(
+ _('Bio'),
[wtforms.validators.Length(min=0, max=500)])
url = wtforms.TextField(
- 'Website',
+ _('Website'),
[wtforms.validators.Optional(),
- wtforms.validators.URL(message='Improperly formed URL')])
+ wtforms.validators.URL(message=_('Improperly formed URL'))])
from mediagoblin.util import (
render_to_response, redirect, clean_html, convert_to_tag_list_of_dicts,
media_tags_as_string, cleaned_markdown_conversion)
+from mediagoblin.util import pass_to_ugettext as _
from mediagoblin.edit import forms
from mediagoblin.edit.lib import may_edit_media
from mediagoblin.decorators import require_active_login, get_user_media_entry
if existing_user_slug_entries:
form.slug.errors.append(
- u'An entry with that slug already exists for this user.')
+ _(u'An entry with that slug already exists for this user.'))
else:
media['title'] = request.POST['title']
media['description'] = request.POST.get('description')
and request.method != 'POST':
messages.add_message(
request, messages.WARNING,
- "You are editing another user's media. Proceed with caution.")
+ _("You are editing another user's media. Proceed with caution."))
return render_to_response(
if request.method != 'POST':
messages.add_message(
request, messages.WARNING,
- "You are editing a user's profile. Proceed with caution.")
+ _("You are editing a user's profile. Proceed with caution."))
else:
user = request.user
import wtforms
+
from mediagoblin.util import tag_length_validator
+from mediagoblin.util import pass_to_ugettext as _
class SubmitStartForm(wtforms.Form):
title = wtforms.TextField(
- 'Title',
+ _('Title'),
[wtforms.validators.Length(min=0, max=500)])
description = wtforms.TextAreaField('Description of this work')
- file = wtforms.FileField('File')
+ file = wtforms.FileField(_('File'))
tags = wtforms.TextField(
- 'Tags',
+ _('Tags'),
[tag_length_validator])
from mediagoblin.util import (
render_to_response, redirect, cleaned_markdown_conversion, \
convert_to_tag_list_of_dicts)
+from mediagoblin.util import pass_to_ugettext as _
from mediagoblin.decorators import require_active_login
from mediagoblin.submit import forms as submit_forms, security
from mediagoblin.process_media import process_media_initial
and isinstance(request.POST['file'], FieldStorage)
and request.POST['file'].file):
submit_form.file.errors.append(
- u'You must provide a file.')
+ _(u'You must provide a file.'))
elif not security.check_filetype(request.POST['file']):
submit_form.file.errors.append(
- u'The file doesn\'t seem to be an image!')
+ _(u"The file doesn't seem to be an image!"))
else:
filename = request.POST['file'].filename
# queue it for processing
process_media_initial.delay(unicode(entry['_id']))
- add_message(request, SUCCESS, 'Woohoo! Submitted!')
+ add_message(request, SUCCESS, _('Woohoo! Submitted!'))
return redirect(request, "mediagoblin.user_pages.user_home",
user = request.user['username'])