fixes #1066 - yesno used the wrong way to do translations

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1673 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Georg Bauer 2005-12-15 15:56:26 +00:00
parent 2b50cb8c12
commit 3c4c6e0f96
1 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@
from django.core.template import resolve_variable, Library
from django.conf.settings import DATE_FORMAT, TIME_FORMAT
from django.utils.translation import gettext
import re
import random as random_module
@ -351,7 +352,7 @@ def divisibleby(value, arg):
"Returns true if the value is devisible by the argument"
return int(value) % int(arg) == 0
def yesno(value, arg=_("yes,no,maybe")):
def yesno(value, arg=None):
"""
Given a string mapping values for true, false and (optionally) None,
returns one of those strings accoding to the value:
@ -366,6 +367,8 @@ def yesno(value, arg=_("yes,no,maybe")):
if no mapping for None is given.
========== ====================== ==================================
"""
if arg is None:
arg = gettext('yes,no,maybe')
bits = arg.split(',')
if len(bits) < 2:
return value # Invalid arg.