Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Russell Keith-Magee authored April 02, 2011
2  django/utils/translation/__init__.py
@@ -55,7 +55,7 @@ def __getattr__(self, real_name):
55 55
                     warnings.warn("Translations in the project directory "
56 56
                                   "aren't supported anymore. Use the "
57 57
                                   "LOCALE_PATHS setting instead.",
58  
-                                  PendingDeprecationWarning)
  58
+                                  DeprecationWarning)
59 59
         else:
60 60
             from django.utils.translation import trans_null as trans
61 61
         setattr(self, real_name, getattr(trans, real_name))
18  django/utils/translation/trans_null.py
@@ -58,21 +58,3 @@ def to_locale(language):
58 58
 
59 59
 def get_language_from_request(request):
60 60
     return settings.LANGUAGE_CODE
61  
-
62  
-# get_date_formats and get_partial_date_formats aren't used anymore by Django
63  
-# but are kept for backward compatibility.
64  
-def get_date_formats():
65  
-    warnings.warn(
66  
-        '`django.utils.translation.get_date_formats` is deprecated. '
67  
-        'Please update your code to use the new i18n aware formatting.',
68  
-        DeprecationWarning
69  
-    )
70  
-    return settings.DATE_FORMAT, settings.DATETIME_FORMAT, settings.TIME_FORMAT
71  
-
72  
-def get_partial_date_formats():
73  
-    warnings.warn(
74  
-        '`django.utils.translation.get_partial_date_formats` is deprecated. '
75  
-        'Please update your code to use the new i18n aware formatting.',
76  
-        DeprecationWarning
77  
-    )
78  
-    return settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT
48  django/utils/translation/trans_real.py
@@ -551,51 +551,3 @@ def parse_accept_lang_header(lang_string):
551 551
         result.append((lang, priority))
552 552
     result.sort(key=lambda k: k[1], reverse=True)
553 553
     return result
554  
-
555  
-# get_date_formats and get_partial_date_formats aren't used anymore by Django
556  
-# and are kept for backward compatibility.
557  
-# Note, it's also important to keep format names marked for translation.
558  
-# For compatibility we still want to have formats on translation catalogs.
559  
-# That makes template code like {{ my_date|date:_('DATE_FORMAT') }} still work
560  
-def get_date_formats():
561  
-    """
562  
-    Checks whether translation files provide a translation for some technical
563  
-    message ID to store date and time formats. If it doesn't contain one, the
564  
-    formats provided in the settings will be used.
565  
-    """
566  
-    warnings.warn(
567  
-        "'django.utils.translation.get_date_formats' is deprecated. "
568  
-        "Please update your code to use the new i18n aware formatting.",
569  
-        DeprecationWarning
570  
-    )
571  
-    from django.conf import settings
572  
-    date_format = ugettext('DATE_FORMAT')
573  
-    datetime_format = ugettext('DATETIME_FORMAT')
574  
-    time_format = ugettext('TIME_FORMAT')
575  
-    if date_format == 'DATE_FORMAT':
576  
-        date_format = settings.DATE_FORMAT
577  
-    if datetime_format == 'DATETIME_FORMAT':
578  
-        datetime_format = settings.DATETIME_FORMAT
579  
-    if time_format == 'TIME_FORMAT':
580  
-        time_format = settings.TIME_FORMAT
581  
-    return date_format, datetime_format, time_format
582  
-
583  
-def get_partial_date_formats():
584  
-    """
585  
-    Checks whether translation files provide a translation for some technical
586  
-    message ID to store partial date formats. If it doesn't contain one, the
587  
-    formats provided in the settings will be used.
588  
-    """
589  
-    warnings.warn(
590  
-        "'django.utils.translation.get_partial_date_formats' is deprecated. "
591  
-        "Please update your code to use the new i18n aware formatting.",
592  
-        DeprecationWarning
593  
-    )
594  
-    from django.conf import settings
595  
-    year_month_format = ugettext('YEAR_MONTH_FORMAT')
596  
-    month_day_format = ugettext('MONTH_DAY_FORMAT')
597  
-    if year_month_format == 'YEAR_MONTH_FORMAT':
598  
-        year_month_format = settings.YEAR_MONTH_FORMAT
599  
-    if month_day_format == 'MONTH_DAY_FORMAT':
600  
-        month_day_format = settings.MONTH_DAY_FORMAT
601  
-    return year_month_format, month_day_format

0 notes on commit 86ba75b

Please sign in to comment.
Something went wrong with that request. Please try again.