From 6fb0c02661dfc21e86dbfe30e8d6b7c9de1fd760 Mon Sep 17 00:00:00 2001
From: Aditi Mittal <aditi.iitr@gmail.com>
Date: Mon, 22 Apr 2013 19:18:45 +0530
Subject: [PATCH] Fix-bug-667-Use-lazy_pass_to_ugettext-for-forms.
---
mediagoblin/auth/forms.py | 2 +-
mediagoblin/auth/views.py | 2 +-
mediagoblin/edit/forms.py | 2 +-
mediagoblin/edit/views.py | 2 +-
mediagoblin/gmg_commands/theme.py | 2 +-
mediagoblin/plugins/oauth/forms.py | 2 +-
mediagoblin/submit/forms.py | 2 +-
mediagoblin/submit/views.py | 2 +-
.../templates/mediagoblin/utils/wtforms.html | 8 ++++----
mediagoblin/tools/exif.py | 2 +-
mediagoblin/user_pages/forms.py | 2 +-
mediagoblin/user_pages/views.py | 2 +-
12 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/mediagoblin/auth/forms.py b/mediagoblin/auth/forms.py
index 8f091d2..90c0d41 100644
a
|
b
|
|
17 | 17 | import wtforms |
18 | 18 | |
19 | 19 | from mediagoblin.tools.mail import normalize_email |
20 | | from mediagoblin.tools.translate import fake_ugettext_passthrough as _ |
| 20 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
21 | 21 | |
22 | 22 | def normalize_user_or_email_field(allow_email=True, allow_user=True): |
23 | 23 | """Check if we were passed a field that matches a username and/or email pattern |
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py
index 354b48c..6b155f0 100644
a
|
b
|
import datetime
|
20 | 20 | from mediagoblin import messages, mg_globals |
21 | 21 | from mediagoblin.db.models import User |
22 | 22 | from mediagoblin.tools.response import render_to_response, redirect, render_404 |
23 | | from mediagoblin.tools.translate import pass_to_ugettext as _ |
| 23 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
24 | 24 | from mediagoblin.auth import lib as auth_lib |
25 | 25 | from mediagoblin.auth import forms as auth_forms |
26 | 26 | from mediagoblin.auth.lib import send_verification_email, \ |
diff --git a/mediagoblin/edit/forms.py b/mediagoblin/edit/forms.py
index 2673967..ef27023 100644
a
|
b
|
|
17 | 17 | import wtforms |
18 | 18 | |
19 | 19 | from mediagoblin.tools.text import tag_length_validator, TOO_LONG_TAG_WARNING |
20 | | from mediagoblin.tools.translate import fake_ugettext_passthrough as _ |
| 20 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
21 | 21 | from mediagoblin.tools.licenses import licenses_as_choices |
22 | 22 | |
23 | 23 | class EditForm(wtforms.Form): |
diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py
index 34b7aac..b0d8dd5 100644
a
|
b
|
from mediagoblin.decorators import (require_active_login, active_user_from_url,
|
29 | 29 | get_media_entry_by_id, |
30 | 30 | user_may_alter_collection, get_user_collection) |
31 | 31 | from mediagoblin.tools.response import render_to_response, redirect |
32 | | from mediagoblin.tools.translate import pass_to_ugettext as _ |
| 32 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
33 | 33 | from mediagoblin.tools.text import ( |
34 | 34 | convert_to_tag_list_of_dicts, media_tags_as_string) |
35 | 35 | from mediagoblin.tools.url import slugify |
diff --git a/mediagoblin/gmg_commands/theme.py b/mediagoblin/gmg_commands/theme.py
index 71abb98..95b9425 100644
a
|
b
|
import os
|
18 | 18 | |
19 | 19 | from mediagoblin.init import setup_global_and_app_config |
20 | 20 | from mediagoblin.tools.theme import register_themes |
21 | | from mediagoblin.tools.translate import pass_to_ugettext as _ |
| 21 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
22 | 22 | from mediagoblin.tools.common import simple_printer |
23 | 23 | |
24 | 24 | |
diff --git a/mediagoblin/plugins/oauth/forms.py b/mediagoblin/plugins/oauth/forms.py
index d0a4e9b..5edd992 100644
a
|
b
|
import wtforms
|
19 | 19 | from urlparse import urlparse |
20 | 20 | |
21 | 21 | from mediagoblin.tools.extlib.wtf_html5 import URLField |
22 | | from mediagoblin.tools.translate import fake_ugettext_passthrough as _ |
| 22 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
23 | 23 | |
24 | 24 | |
25 | 25 | class AuthorizationForm(wtforms.Form): |
diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py
index bd1e904..e9bd93f 100644
a
|
b
|
|
18 | 18 | import wtforms |
19 | 19 | |
20 | 20 | from mediagoblin.tools.text import tag_length_validator |
21 | | from mediagoblin.tools.translate import fake_ugettext_passthrough as _ |
| 21 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
22 | 22 | from mediagoblin.tools.licenses import licenses_as_choices |
23 | 23 | |
24 | 24 | |
diff --git a/mediagoblin/submit/views.py b/mediagoblin/submit/views.py
index 9d31c84..1a7c0ce 100644
a
|
b
|
_log = logging.getLogger(__name__)
|
24 | 24 | |
25 | 25 | |
26 | 26 | from mediagoblin.tools.text import convert_to_tag_list_of_dicts |
27 | | from mediagoblin.tools.translate import pass_to_ugettext as _ |
| 27 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
28 | 28 | from mediagoblin.tools.response import render_to_response, redirect |
29 | 29 | from mediagoblin.decorators import require_active_login |
30 | 30 | from mediagoblin.submit import forms as submit_forms |
diff --git a/mediagoblin/templates/mediagoblin/utils/wtforms.html b/mediagoblin/templates/mediagoblin/utils/wtforms.html
index 35b4aa0..be6976c 100644
a
|
b
|
|
19 | 19 | {# Render the label for a field #} |
20 | 20 | {% macro render_label(field) %} |
21 | 21 | {%- if field.label.text -%} |
22 | | <label for="{{ field.label.field_id }}">{{ _(field.label.text) }}</label> |
| 22 | <label for="{{ field.label.field_id }}">{{ field.label.text }}</label> |
23 | 23 | {%- endif -%} |
24 | 24 | {%- endmacro %} |
25 | 25 | |
… |
… |
|
39 | 39 | {{ field }} |
40 | 40 | {%- if field.errors -%} |
41 | 41 | {% for error in field.errors %} |
42 | | <p class="form_field_error">{{ _(error) }}</p> |
| 42 | <p class="form_field_error">{{ error }}</p> |
43 | 43 | {% endfor %} |
44 | 44 | {%- endif %} |
45 | 45 | {%- if field.description %} |
46 | | <p class="form_field_description">{{ _(field.description)|safe }}</p> |
| 46 | <p class="form_field_description">{{ field.description|safe }}</p> |
47 | 47 | {%- endif %} |
48 | 48 | </div> |
49 | 49 | {%- endmacro %} |
… |
… |
|
59 | 59 | {% macro render_table(form) -%} |
60 | 60 | {% for field in form %} |
61 | 61 | <tr> |
62 | | <th>{{ _(field.label.text) }}</th> |
| 62 | <th>{{ field.label.text }}</th> |
63 | 63 | <td> |
64 | 64 | {{field}} |
65 | 65 | {% if field.errors %} |
diff --git a/mediagoblin/tools/exif.py b/mediagoblin/tools/exif.py
index d0f9d0a..ced9ee8 100644
a
|
b
|
except ImportError:
|
20 | 20 | from mediagoblin.tools.extlib.EXIF import process_file, Ratio |
21 | 21 | |
22 | 22 | from mediagoblin.processing import BadMediaFail |
23 | | from mediagoblin.tools.translate import pass_to_ugettext as _ |
| 23 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
24 | 24 | |
25 | 25 | # A list of tags that should be stored for faster access |
26 | 26 | USEFUL_TAGS = [ |
diff --git a/mediagoblin/user_pages/forms.py b/mediagoblin/user_pages/forms.py
index e9746a6..9a19368 100644
a
|
b
|
|
16 | 16 | |
17 | 17 | import wtforms |
18 | 18 | from wtforms.ext.sqlalchemy.fields import QuerySelectField |
19 | | from mediagoblin.tools.translate import fake_ugettext_passthrough as _ |
| 19 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
20 | 20 | |
21 | 21 | class MediaCommentForm(wtforms.Form): |
22 | 22 | comment_content = wtforms.TextAreaField( |
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 61c23f1..5510f88 100644
a
|
b
|
from mediagoblin import messages, mg_globals
|
21 | 21 | from mediagoblin.db.models import (MediaEntry, MediaTag, Collection, |
22 | 22 | CollectionItem, User) |
23 | 23 | from mediagoblin.tools.response import render_to_response, render_404, redirect |
24 | | from mediagoblin.tools.translate import pass_to_ugettext as _ |
| 24 | from mediagoblin.tools.translate import lazy_pass_to_ugettext as _ |
25 | 25 | from mediagoblin.tools.pagination import Pagination |
26 | 26 | from mediagoblin.user_pages import forms as user_forms |
27 | 27 | from mediagoblin.user_pages.lib import send_comment_email |