diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-01-09 21:47:15 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2013-01-09 21:47:15 -0300 |
commit | ed72db61da21c2e93f6acaf0afca576f566f5a91 (patch) | |
tree | 6e60541a48444528e7b466d90d5a6ea7aed60804 /askbot/models | |
parent | 616585cec22c9f9d457dc92bb7fe2c04b63dde65 (diff) | |
download | askbot-ed72db61da21c2e93f6acaf0afca576f566f5a91.tar.gz askbot-ed72db61da21c2e93f6acaf0afca576f566f5a91.tar.bz2 askbot-ed72db61da21c2e93f6acaf0afca576f566f5a91.zip |
broken
Diffstat (limited to 'askbot/models')
-rw-r--r-- | askbot/models/__init__.py | 24 | ||||
-rw-r--r-- | askbot/models/badges.py | 2 | ||||
-rw-r--r-- | askbot/models/message.py | 4 | ||||
-rw-r--r-- | askbot/models/post.py | 3 | ||||
-rw-r--r-- | askbot/models/question.py | 6 | ||||
-rw-r--r-- | askbot/models/reply_by_email.py | 15 | ||||
-rw-r--r-- | askbot/models/repute.py | 2 | ||||
-rw-r--r-- | askbot/models/tag.py | 9 | ||||
-rw-r--r-- | askbot/models/user.py | 21 | ||||
-rw-r--r-- | askbot/models/widgets.py | 6 |
10 files changed, 47 insertions, 45 deletions
diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index d5091d31..21bd1781 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -22,8 +22,8 @@ from django.core.urlresolvers import reverse, NoReverseMatch from django.db.models import signals as django_signals from django.template import Context from django.template.loader import get_template -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ungettext_lazy +from django.utils.translation import ugettext as _ +from django.utils.translation import ungettext from django.utils.safestring import mark_safe from django.utils.html import escape from django.db import models @@ -735,7 +735,7 @@ def user_assert_can_edit_comment(self, comment = None): if now - comment.added_at > datetime.timedelta(0, delta_seconds): if comment.is_last(): return - error_message = ungettext_lazy( + error_message = ungettext( 'Sorry, comments (except the last one) are editable only ' 'within %(minutes)s minute from posting', 'Sorry, comments (except the last one) are editable only ' @@ -917,7 +917,7 @@ def user_assert_can_delete_question(self, question = None): if self.is_administrator() or self.is_moderator(): return else: - msg = ungettext_lazy( + msg = ungettext( 'Sorry, cannot delete your question since it ' 'has an upvoted answer posted by someone else', 'Sorry, cannot delete your question since it ' @@ -1110,7 +1110,7 @@ def user_assert_can_remove_flag_offensive(self, post = None): ) min_rep_setting = askbot_settings.MIN_REP_TO_FLAG_OFFENSIVE - low_rep_error_message = ungettext_lazy( + low_rep_error_message = ungettext( 'Sorry, to flag posts a minimum reputation of %(min_rep)d is required', 'Sorry, to flag posts a minimum reputation of %(min_rep)d is required', min_rep_setting @@ -1884,10 +1884,10 @@ def user_post_answer( elif days == 1: left = _('tomorrow') elif minutes >= 60: - left = ungettext_lazy('in %(hr)d hour','in %(hr)d hours',hours) % {'hr':hours} + left = ungettext('in %(hr)d hour','in %(hr)d hours',hours) % {'hr':hours} else: - left = ungettext_lazy('in %(min)d min','in %(min)d mins',minutes) % {'min':minutes} - day = ungettext_lazy('%(days)d day','%(days)d days',askbot_settings.MIN_DAYS_TO_ANSWER_OWN_QUESTION) % {'days':askbot_settings.MIN_DAYS_TO_ANSWER_OWN_QUESTION} + left = ungettext('in %(min)d min','in %(min)d mins',minutes) % {'min':minutes} + day = ungettext('%(days)d day','%(days)d days',askbot_settings.MIN_DAYS_TO_ANSWER_OWN_QUESTION) % {'days':askbot_settings.MIN_DAYS_TO_ANSWER_OWN_QUESTION} error_message = _( 'New users must wait %(days)s before answering their own question. ' ' You can post an answer %(left)s' @@ -2384,21 +2384,21 @@ def user_get_badge_summary(self): by the user. It is assumed that user has some badges""" badge_bits = list() if self.gold: - bit = ungettext_lazy( + bit = ungettext( 'one gold badge', '%(count)d gold badges', self.gold ) % {'count': self.gold} badge_bits.append(bit) if self.silver: - bit = ungettext_lazy( + bit = ungettext( 'one silver badge', '%(count)d silver badges', self.silver ) % {'count': self.silver} badge_bits.append(bit) if self.bronze: - bit = ungettext_lazy( + bit = ungettext( 'one bronze badge', '%(count)d bronze badges', self.bronze @@ -2546,7 +2546,7 @@ def user_fix_html_links(self, text): if is_simple_user and has_low_rep: result = replace_links_with_text(text) if result != text: - message = ungettext_lazy( + message = ungettext( 'At least %d karma point is required to post links', 'At least %d karma points is required to post links', askbot_settings.MIN_REP_TO_INSERT_LINK diff --git a/askbot/models/badges.py b/askbot/models/badges.py index afd0ff5f..244c8e2f 100644 --- a/askbot/models/badges.py +++ b/askbot/models/badges.py @@ -20,7 +20,7 @@ corresponding event name, actor (user object), context_object and optionally import datetime from django.template.defaultfilters import slugify from django.contrib.contenttypes.models import ContentType -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _ from django.dispatch import Signal from askbot.models.repute import BadgeData, Award from askbot.models.user import Activity diff --git a/askbot/models/message.py b/askbot/models/message.py index 31a0e0d4..a2da9c51 100644 --- a/askbot/models/message.py +++ b/askbot/models/message.py @@ -1,7 +1,7 @@ '''Copied from Django 1.3.1 source code, it will use this model to''' from django.db import models from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy class Message(models.Model): """ @@ -13,7 +13,7 @@ class Message(models.Model): message. """ user = models.ForeignKey(User, related_name='_message_set') - message = models.TextField(_('message')) + message = models.TextField(ugettext_lazy('message')) class Meta: '''Added for backwards compatibility with databases diff --git a/askbot/models/post.py b/askbot/models/post.py index cec88f1a..8d64c03f 100644 --- a/askbot/models/post.py +++ b/askbot/models/post.py @@ -12,8 +12,7 @@ from django.contrib.auth.models import User from django.core import urlresolvers from django.db import models from django.utils import html as html_utils -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ungettext_lazy +from django.utils.translation import ugettext as _ from django.utils.http import urlquote as django_urlquote from django.core import exceptions as django_exceptions from django.core import cache diff --git a/askbot/models/question.py b/askbot/models/question.py index 7bf66c26..f1fb9a0f 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -10,8 +10,8 @@ from django.core import exceptions as django_exceptions from django.core.urlresolvers import reverse from django.template.loader import get_template from django.utils.hashcompat import md5_constructor -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ungettext_lazy +from django.utils.translation import ugettext as _ +from django.utils.translation import ungettext from django.utils.translation import string_concat from django.utils.translation import get_language @@ -740,7 +740,7 @@ class Thread(models.Model): output = question.format_for_email_as_subthread() if answers: - answer_heading = ungettext_lazy( + answer_heading = ungettext( '%(count)d answer:', '%(count)d answers:', len(answers) diff --git a/askbot/models/reply_by_email.py b/askbot/models/reply_by_email.py index 68033896..983edc8f 100644 --- a/askbot/models/reply_by_email.py +++ b/askbot/models/reply_by_email.py @@ -4,7 +4,8 @@ import string import logging from django.db import models from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy from askbot.models.post import Post from askbot.models.base import BaseQuerySetManager from askbot.conf import settings as askbot_settings @@ -34,12 +35,12 @@ class ReplyAddressManager(BaseQuerySetManager): REPLY_ACTION_CHOICES = ( - ('post_answer', _('Post an answer')), - ('post_comment', _('Post a comment')), - ('replace_content', _('Edit post')), - ('append_content', _('Append to post')), - ('auto_answer_or_comment', _('Answer or comment, depending on the size of post')), - ('validate_email', _('Validate email and record signature')), + ('post_answer', ugettext_lazy('Post an answer')), + ('post_comment', ugettext_lazy('Post a comment')), + ('replace_content', ugettext_lazy('Edit post')), + ('append_content', ugettext_lazy('Append to post')), + ('auto_answer_or_comment', ugettext_lazy('Answer or comment, depending on the size of post')), + ('validate_email', ugettext_lazy('Validate email and record signature')), ) class ReplyAddress(models.Model): """Stores a reply address for the post diff --git a/askbot/models/repute.py b/askbot/models/repute.py index 1cc830dc..e48773e6 100644 --- a/askbot/models/repute.py +++ b/askbot/models/repute.py @@ -3,7 +3,7 @@ from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.contrib.auth.models import User from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _ from django.utils.html import escape from askbot import const from django.core.urlresolvers import reverse diff --git a/askbot/models/tag.py b/askbot/models/tag.py index 106e7174..7b51e6db 100644 --- a/askbot/models/tag.py +++ b/askbot/models/tag.py @@ -1,7 +1,8 @@ import re from django.db import models from django.contrib.auth.models import User -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy from django.conf import settings from askbot.models.base import BaseQuerySetManager from askbot import const @@ -307,9 +308,9 @@ class Tag(models.Model): class MarkedTag(models.Model): TAG_MARK_REASONS = ( - ('good', _('interesting')), - ('bad', _('ignored')), - ('subscribed', _('subscribed')), + ('good', ugettext_lazy('interesting')), + ('bad', ugettext_lazy('ignored')), + ('subscribed', ugettext_lazy('subscribed')), ) tag = models.ForeignKey('Tag', related_name='user_selections') user = models.ForeignKey(User, related_name='tag_selections') diff --git a/askbot/models/user.py b/askbot/models/user.py index 45755fbe..6601fc7e 100644 --- a/askbot/models/user.py +++ b/askbot/models/user.py @@ -9,7 +9,8 @@ from django.contrib.auth.models import User from django.contrib.auth.models import Group as AuthGroup from django.core import exceptions from django.forms import EmailField, URLField -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext as _ +from django.utils.translation import ugettext_lazy from django.utils.html import strip_tags from askbot import const from askbot.conf import settings as askbot_settings @@ -279,17 +280,17 @@ class EmailFeedSetting(models.Model): 'm_and_c': 'i' } FEED_TYPE_CHOICES = ( - ('q_all',_('Entire forum')), - ('q_ask',_('Questions that I asked')), - ('q_ans',_('Questions that I answered')), - ('q_sel',_('Individually selected questions')), - ('m_and_c',_('Mentions and comment responses')), + ('q_all', ugettext_lazy('Entire forum')), + ('q_ask', ugettext_lazy('Questions that I asked')), + ('q_ans', ugettext_lazy('Questions that I answered')), + ('q_sel', ugettext_lazy('Individually selected questions')), + ('m_and_c', ugettext_lazy('Mentions and comment responses')), ) UPDATE_FREQUENCY = ( - ('i',_('Instantly')), - ('d',_('Daily')), - ('w',_('Weekly')), - ('n',_('No email')), + ('i', ugettext_lazy('Instantly')), + ('d', ugettext_lazy('Daily')), + ('w', ugettext_lazy('Weekly')), + ('n', ugettext_lazy('No email')), ) diff --git a/askbot/models/widgets.py b/askbot/models/widgets.py index 8ffe9577..bdec5eb2 100644 --- a/askbot/models/widgets.py +++ b/askbot/models/widgets.py @@ -1,5 +1,5 @@ from django.db import models -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy from askbot.models import Tag, Group from askbot.const import DEFAULT_QUESTION_WIDGET_STYLE, SEARCH_ORDER_BY @@ -24,14 +24,14 @@ class AskWidget(models.Model): class QuestionWidget(models.Model): title = models.CharField(max_length=100) question_number = models.PositiveIntegerField(default=7) - tagnames = models.CharField(_('tags'), max_length=50) + tagnames = models.CharField(ugettext_lazy('tags'), max_length=50) group = models.ForeignKey(Group, null=True, blank=True) search_query = models.CharField( max_length=50, null=True, blank=True, default='' ) order_by = models.CharField(max_length=18, choices=SEARCH_ORDER_BY, default='-added_at') - style = models.TextField(_('css for the widget'), + style = models.TextField(ugettext_lazy('css for the widget'), default=DEFAULT_QUESTION_WIDGET_STYLE, blank=True) class Meta: |