Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Advanced deprecations in django.utils.translation.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 86ba75b0904ec4cba2945881f48a628c66b9d0c5 1 parent 87508fb
@freakboy3742 freakboy3742 authored
View
2  django/utils/translation/__init__.py
@@ -55,7 +55,7 @@ def __getattr__(self, real_name):
warnings.warn("Translations in the project directory "
"aren't supported anymore. Use the "
"LOCALE_PATHS setting instead.",
- PendingDeprecationWarning)
+ DeprecationWarning)
else:
from django.utils.translation import trans_null as trans
setattr(self, real_name, getattr(trans, real_name))
View
18 django/utils/translation/trans_null.py
@@ -58,21 +58,3 @@ def to_locale(language):
def get_language_from_request(request):
return settings.LANGUAGE_CODE
-
-# get_date_formats and get_partial_date_formats aren't used anymore by Django
-# but are kept for backward compatibility.
-def get_date_formats():
- warnings.warn(
- '`django.utils.translation.get_date_formats` is deprecated. '
- 'Please update your code to use the new i18n aware formatting.',
- DeprecationWarning
- )
- return settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT
-
-def get_partial_date_formats():
- warnings.warn(
- '`django.utils.translation.get_partial_date_formats` is deprecated. '
- 'Please update your code to use the new i18n aware formatting.',
- DeprecationWarning
- )
- return settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT
View
48 django/utils/translation/trans_real.py
@@ -551,51 +551,3 @@ def parse_accept_lang_header(lang_string):
result.append((lang, priority))
result.sort(key=lambda k: k[1], reverse=True)
return result
-
-# get_date_formats and get_partial_date_formats aren't used anymore by Django
-# and are kept for backward compatibility.
-# Note, it's also important to keep format names marked for translation.
-# For compatibility we still want to have formats on translation catalogs.
-# That makes template code like {{ my_date|date:_('DATE_FORMAT') }} still work
-def get_date_formats():
- """
- Checks whether translation files provide a translation for some technical
- message ID to store date and time formats. If it doesn't contain one, the
- formats provided in the settings will be used.
- """
- warnings.warn(
- "'django.utils.translation.get_date_formats' is deprecated. "
- "Please update your code to use the new i18n aware formatting.",
- DeprecationWarning
- )
- from django.conf import settings
- date_format = ugettext('DATE_FORMAT')
- datetime_format = ugettext('DATETIME_FORMAT')
- time_format = ugettext('TIME_FORMAT')
- if date_format == 'DATE_FORMAT':
- date_format = settings.DATE_FORMAT
- if datetime_format == 'DATETIME_FORMAT':
- datetime_format = settings.DATETIME_FORMAT
- if time_format == 'TIME_FORMAT':
- time_format = settings.TIME_FORMAT
- return date_format, datetime_format, time_format
-
-def get_partial_date_formats():
- """
- Checks whether translation files provide a translation for some technical
- message ID to store partial date formats. If it doesn't contain one, the
- formats provided in the settings will be used.
- """
- warnings.warn(
- "'django.utils.translation.get_partial_date_formats' is deprecated. "
- "Please update your code to use the new i18n aware formatting.",
- DeprecationWarning
- )
- from django.conf import settings
- year_month_format = ugettext('YEAR_MONTH_FORMAT')
- month_day_format = ugettext('MONTH_DAY_FORMAT')
- if year_month_format == 'YEAR_MONTH_FORMAT':
- year_month_format = settings.YEAR_MONTH_FORMAT
- if month_day_format == 'MONTH_DAY_FORMAT':
- month_day_format = settings.MONTH_DAY_FORMAT
- return year_month_format, month_day_format
Please sign in to comment.
Something went wrong with that request. Please try again.