Code

Ticket #7830: deprecated.patch

File deprecated.patch, 24.5 KB (added by gwilson, 6 years ago)
  • django/db/models/fields/subclassing.py

     
    55to_python() and the other necessary methods and everything will work seamlessly. 
    66""" 
    77 
    8 from django.utils.maxlength import LegacyMaxlength 
    9  
    10 class SubfieldBase(LegacyMaxlength): 
     8class SubfieldBase(type): 
    119    """ 
    1210    A metaclass for custom Field subclasses. This ensures the model's attribute 
    1311    has the descriptor protocol attached to it. 
     
    5048        setattr(cls, self.name, Creator(self)) 
    5149 
    5250    return contribute_to_class 
    53  
  • django/db/models/fields/__init__.py

     
    2222from django.utils.text import capfirst 
    2323from django.utils.translation import ugettext_lazy, ugettext as _ 
    2424from django.utils.encoding import smart_unicode, force_unicode, smart_str 
    25 from django.utils.maxlength import LegacyMaxlength 
    2625from django.utils import datetime_safe 
    2726 
    2827class NOT_PROVIDED: 
     
    6261#     getattr(obj, opts.pk.attname) 
    6362 
    6463class Field(object): 
    65     # Provide backwards compatibility for the maxlength attribute and 
    66     # argument for this class and all subclasses. 
    67     __metaclass__ = LegacyMaxlength 
    68  
    6964    # Designates whether empty strings fundamentally are allowed at the 
    7065    # database level. 
    7166    empty_strings_allowed = True 
  • django/db/models/fields/related.py

     
    606606            to_field = to_field or to._meta.pk.name 
    607607        kwargs['verbose_name'] = kwargs.get('verbose_name', '') 
    608608 
    609         if 'edit_inline_type' in kwargs: 
    610             import warnings 
    611             warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.", DeprecationWarning) 
    612             kwargs['edit_inline'] = kwargs.pop('edit_inline_type') 
    613  
    614609        kwargs['rel'] = rel_class(to, to_field, 
    615610            num_in_admin=kwargs.pop('num_in_admin', 3), 
    616611            min_num_in_admin=kwargs.pop('min_num_in_admin', None), 
  • django/db/models/query.py

     
    757757        yield iter([]).next() 
    758758 
    759759 
    760 # QOperator, QNot, QAnd and QOr are temporarily retained for backwards 
    761 # compatibility. All the old functionality is now part of the 'Q' class. 
    762 class QOperator(Q): 
    763     def __init__(self, *args, **kwargs): 
    764         warnings.warn('Use Q instead of QOr, QAnd or QOperation.', 
    765                 DeprecationWarning, stacklevel=2) 
    766         super(QOperator, self).__init__(*args, **kwargs) 
    767  
    768 QOr = QAnd = QOperator 
    769  
    770  
    771 def QNot(q): 
    772     warnings.warn('Use ~q instead of QNot(q)', DeprecationWarning, stacklevel=2) 
    773     return ~q 
    774  
    775  
    776760def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0, 
    777761                   requested=None): 
    778762    """ 
  • django/oldforms/__init__.py

     
    55from django.conf import settings 
    66from django.utils.translation import ugettext, ungettext 
    77from django.utils.encoding import smart_unicode, force_unicode 
    8 from django.utils.maxlength import LegacyMaxlength 
    98 
    109FORM_FIELD_ID_PREFIX = 'id_' 
    1110 
     
    304303    Subclasses should also implement a render(data) method, which is responsible 
    305304    for rending the form field in XHTML. 
    306305    """ 
    307     # Provide backwards compatibility for the maxlength attribute and 
    308     # argument for this class and all subclasses. 
    309     __metaclass__ = LegacyMaxlength 
    310306 
    311307    def __str__(self): 
    312308        return unicode(self).encode('utf-8') 
  • django/core/cache/__init__.py

     
    2828    'dummy': 'dummy', 
    2929} 
    3030 
    31 DEPRECATED_BACKENDS = { 
    32     # deprecated backend --> replacement module 
    33     'simple': 'locmem', 
    34 } 
    35  
    3631def get_cache(backend_uri): 
    3732    if backend_uri.find(':') == -1: 
    3833        raise InvalidCacheBackendError, "Backend URI must start with scheme://" 
    3934    scheme, rest = backend_uri.split(':', 1) 
    4035    if not rest.startswith('//'): 
    4136        raise InvalidCacheBackendError, "Backend URI must start with scheme://" 
    42     if scheme in DEPRECATED_BACKENDS: 
    43         import warnings 
    44         warnings.warn("'%s' backend is deprecated. Use '%s' instead." %  
    45             (scheme, DEPRECATED_BACKENDS[scheme]), DeprecationWarning) 
    46         scheme = DEPRECATED_BACKENDS[scheme] 
    4737    if scheme not in BACKENDS: 
    4838        raise InvalidCacheBackendError, "%r is not a valid cache backend" % scheme 
    4939 
  • django/core/paginator.py

     
    112112        if self.number == self.paginator.num_pages: 
    113113            return self.paginator.count 
    114114        return self.number * self.paginator.per_page 
    115  
    116 class ObjectPaginator(Paginator): 
    117     """ 
    118     Legacy ObjectPaginator class, for backwards compatibility. 
    119  
    120     Note that each method on this class that takes page_number expects a 
    121     zero-based page number, whereas the new API (Paginator/Page) uses one-based 
    122     page numbers. 
    123     """ 
    124     def __init__(self, query_set, num_per_page, orphans=0): 
    125         Paginator.__init__(self, query_set, num_per_page, orphans) 
    126         import warnings 
    127         warnings.warn("The ObjectPaginator is deprecated. Use django.core.paginator.Paginator instead.", DeprecationWarning) 
    128  
    129         # Keep these attributes around for backwards compatibility. 
    130         self.query_set = query_set 
    131         self.num_per_page = num_per_page 
    132         self._hits = self._pages = None 
    133  
    134     def validate_page_number(self, page_number): 
    135         try: 
    136             page_number = int(page_number) + 1 
    137         except ValueError: 
    138             raise PageNotAnInteger 
    139         return self.validate_number(page_number) 
    140  
    141     def get_page(self, page_number): 
    142         try: 
    143             page_number = int(page_number) + 1 
    144         except ValueError: 
    145             raise PageNotAnInteger 
    146         return self.page(page_number).object_list 
    147  
    148     def has_next_page(self, page_number): 
    149         return page_number < self.pages - 1 
    150  
    151     def has_previous_page(self, page_number): 
    152         return page_number > 0 
    153  
    154     def first_on_page(self, page_number): 
    155         """ 
    156         Returns the 1-based index of the first object on the given page, 
    157         relative to total objects found (hits). 
    158         """ 
    159         page_number = self.validate_page_number(page_number) 
    160         return (self.num_per_page * (page_number - 1)) + 1 
    161  
    162     def last_on_page(self, page_number): 
    163         """ 
    164         Returns the 1-based index of the last object on the given page, 
    165         relative to total objects found (hits). 
    166         """ 
    167         page_number = self.validate_page_number(page_number) 
    168         if page_number == self.num_pages: 
    169             return self.count 
    170         return page_number * self.num_per_page 
    171  
    172     def _get_count(self): 
    173         # The old API allowed for self.object_list to be either a QuerySet or a 
    174         # list. Here, we handle both. 
    175         if self._count is None: 
    176             try: 
    177                 self._count = self.object_list.count() 
    178             except (AttributeError, TypeError): 
    179                 # AttributeError if object_list has no count() method. 
    180                 # TypeError if object_list.count() requires arguments 
    181                 # (i.e. is of type list). 
    182                 self._count = len(self.object_list) 
    183         return self._count 
    184     count = property(_get_count) 
    185  
    186     # The old API called it "hits" instead of "count". 
    187     hits = count 
    188  
    189     # The old API called it "pages" instead of "num_pages". 
    190     pages = Paginator.num_pages 
  • django/utils/maxlength.py

     
    1 """ 
    2 Utilities for providing backwards compatibility for the maxlength argument, 
    3 which has been replaced by max_length. See ticket #2101. 
    4 """ 
    5  
    6 from warnings import warn 
    7  
    8 def get_maxlength(self): 
    9     return self.max_length 
    10  
    11 def set_maxlength(self, value): 
    12     self.max_length = value 
    13  
    14 def legacy_maxlength(max_length, maxlength): 
    15     """ 
    16     Consolidates max_length and maxlength, providing backwards compatibilty 
    17     for the legacy "maxlength" argument. 
    18  
    19     If one of max_length or maxlength is given, then that value is returned. 
    20     If both are given, a TypeError is raised. If maxlength is used at all, a 
    21     deprecation warning is issued. 
    22     """ 
    23     if maxlength is not None: 
    24         warn("maxlength is deprecated. Use max_length instead.", DeprecationWarning, stacklevel=3) 
    25         if max_length is not None: 
    26             raise TypeError("Field cannot take both the max_length argument and the legacy maxlength argument.") 
    27         max_length = maxlength 
    28     return max_length 
    29  
    30 def remove_maxlength(func): 
    31     """ 
    32     A decorator to be used on a class's __init__ that provides backwards 
    33     compatibilty for the legacy "maxlength" keyword argument, i.e. 
    34         name = models.CharField(maxlength=20) 
    35  
    36     It does this by changing the passed "maxlength" keyword argument 
    37     (if it exists) into a "max_length" keyword argument. 
    38     """ 
    39     def inner(self, *args, **kwargs): 
    40         max_length = kwargs.get('max_length', None) 
    41         # pop maxlength because we don't want this going to __init__. 
    42         maxlength = kwargs.pop('maxlength', None) 
    43         max_length = legacy_maxlength(max_length, maxlength) 
    44         # Only set the max_length keyword argument if we got a value back. 
    45         if max_length is not None: 
    46             kwargs['max_length'] = max_length 
    47         func(self, *args, **kwargs) 
    48     return inner 
    49  
    50 # This metaclass is used in two places, and should be removed when legacy 
    51 # support for maxlength is dropped. 
    52 #   * oldforms.FormField 
    53 #   * db.models.fields.Field 
    54  
    55 class LegacyMaxlength(type): 
    56     """ 
    57     Metaclass for providing backwards compatibility support for the 
    58     "maxlength" keyword argument. 
    59     """ 
    60     def __init__(cls, name, bases, attrs): 
    61         super(LegacyMaxlength, cls).__init__(name, bases, attrs) 
    62         # Decorate the class's __init__ to remove any maxlength keyword. 
    63         cls.__init__ = remove_maxlength(cls.__init__) 
    64         # Support accessing and setting to the legacy maxlength attribute. 
    65         cls.maxlength = property(get_maxlength, set_maxlength) 
  • tests/modeltests/pagination/models.py

     
    44Django provides a framework for paginating a list of objects in a few lines 
    55of code. This is often useful for dividing search results or long lists of 
    66objects into easily readable pages. 
    7  
    8 In Django 0.96 and earlier, a single ObjectPaginator class implemented this 
    9 functionality. In the Django development version, the behavior is split across 
    10 two classes -- Paginator and Page -- that are more easier to use. The legacy 
    11 ObjectPaginator class is deprecated. 
    127""" 
    138 
    149from django.db import models 
     
    2722...     a = Article(headline='Article %s' % x, pub_date=datetime(2005, 7, 29)) 
    2823...     a.save() 
    2924 
    30 #################################### 
    31 # New/current API (Paginator/Page) # 
    32 #################################### 
     25################## 
     26# Paginator/Page # 
     27################## 
    3328 
    3429>>> from django.core.paginator import Paginator 
    3530>>> paginator = Paginator(Article.objects.all(), 5) 
     
    140135>>> p.end_index() 
    1411365 
    142137 
    143 ################################ 
    144 # Legacy API (ObjectPaginator) # 
    145 ################################ 
    146138 
    147 # Don't print out the deprecation warnings during testing. 
    148 >>> from warnings import filterwarnings 
    149 >>> filterwarnings("ignore") 
    150  
    151 >>> from django.core.paginator import ObjectPaginator, EmptyPage 
    152 >>> paginator = ObjectPaginator(Article.objects.all(), 5) 
    153 >>> paginator.hits 
    154 9 
    155 >>> paginator.pages 
    156 2 
    157 >>> paginator.page_range 
    158 [1, 2] 
    159  
    160 # Get the first page. 
    161 >>> paginator.get_page(0) 
    162 [<Article: Article 1>, <Article: Article 2>, <Article: Article 3>, <Article: Article 4>, <Article: Article 5>] 
    163 >>> paginator.has_next_page(0) 
    164 True 
    165 >>> paginator.has_previous_page(0) 
    166 False 
    167 >>> paginator.first_on_page(0) 
    168 1 
    169 >>> paginator.last_on_page(0) 
    170 5 
    171  
    172 # Get the second page. 
    173 >>> paginator.get_page(1) 
    174 [<Article: Article 6>, <Article: Article 7>, <Article: Article 8>, <Article: Article 9>] 
    175 >>> paginator.has_next_page(1) 
    176 False 
    177 >>> paginator.has_previous_page(1) 
    178 True 
    179 >>> paginator.first_on_page(1) 
    180 6 
    181 >>> paginator.last_on_page(1) 
    182 9 
    183  
    184 # Invalid pages raise EmptyPage. 
    185 >>> paginator.get_page(-1) 
    186 Traceback (most recent call last): 
    187 ... 
    188 EmptyPage: ... 
    189 >>> paginator.get_page(2) 
    190 Traceback (most recent call last): 
    191 ... 
    192 EmptyPage: ... 
    193  
    194 # Empty paginators with allow_empty_first_page=True. 
    195 >>> paginator = ObjectPaginator(Article.objects.filter(id=0), 5) 
    196 >>> paginator.count 
    197 0 
    198 >>> paginator.num_pages 
    199 1 
    200 >>> paginator.page_range 
    201 [1] 
    202  
    203 # ObjectPaginator can be passed lists too. 
    204 >>> paginator = ObjectPaginator([1, 2, 3], 5) 
    205 >>> paginator.hits 
    206 3 
    207 >>> paginator.pages 
    208 1 
    209 >>> paginator.page_range 
    210 [1] 
    211  
    212  
    213 # ObjectPaginator can be passed other objects with a count() method. 
    214 >>> class Container: 
    215 ...     def __len__(self): 
    216 ...         return 42 
    217 >>> paginator = ObjectPaginator(Container(), 10) 
    218 >>> paginator.hits 
    219 42 
    220 >>> paginator.pages 
    221 5 
    222 >>> paginator.page_range 
    223 [1, 2, 3, 4, 5] 
    224  
    225  
    226139################## 
    227140# Orphan support # 
    228141################## 
     
    2371501 
    238151 
    239152# With orphans only set to 1, we should get two pages. 
    240 >>> paginator = ObjectPaginator(Article.objects.all(), 10, orphans=1) 
     153>>> paginator = Paginator(Article.objects.all(), 10, orphans=1) 
    241154>>> paginator.num_pages 
    2421552 
    243  
    244 # LEGACY: With orphans set to 3 and 10 items per page, we should get all 12 items on a single page. 
    245 >>> paginator = ObjectPaginator(Article.objects.all(), 10, orphans=3) 
    246 >>> paginator.pages 
    247 1 
    248  
    249 # LEGACY: With orphans only set to 1, we should get two pages. 
    250 >>> paginator = ObjectPaginator(Article.objects.all(), 10, orphans=1) 
    251 >>> paginator.pages 
    252 2 
    253156"""} 
  • tests/regressiontests/max_lengths/tests.py

     
    1313        self.verify_max_length(PersonWithDefaultMaxLengths, 'homepage', 200) 
    1414        self.verify_max_length(PersonWithDefaultMaxLengths, 'avatar', 100) 
    1515 
    16     def test_custom_maxlengths(self): 
     16    def test_custom_max_lengths(self): 
    1717        self.verify_max_length(PersonWithCustomMaxLengths, 'email', 384) 
    1818        self.verify_max_length(PersonWithCustomMaxLengths, 'vcard', 1024) 
    1919        self.verify_max_length(PersonWithCustomMaxLengths, 'homepage', 256) 
  • tests/regressiontests/maxlength/tests.py

     
    1 # Test access to max_length while still providing full backwards compatibility 
    2 # with legacy maxlength attribute. 
    3 """ 
    4  
    5 Don't print out the deprecation warnings during testing. 
    6 >>> from warnings import filterwarnings 
    7 >>> filterwarnings("ignore") 
    8  
    9 # legacy_maxlength function 
    10  
    11 >>> from django.utils.maxlength import legacy_maxlength 
    12  
    13 >>> legacy_maxlength(None, None) 
    14  
    15  
    16 >>> legacy_maxlength(10, None) 
    17 10 
    18  
    19 >>> legacy_maxlength(None, 10) 
    20 10 
    21  
    22 >>> legacy_maxlength(10, 12) 
    23 Traceback (most recent call last): 
    24 ... 
    25 TypeError: Field cannot take both the max_length argument and the legacy maxlength argument. 
    26  
    27 >>> legacy_maxlength(0, 10) 
    28 Traceback (most recent call last): 
    29 ... 
    30 TypeError: Field cannot take both the max_length argument and the legacy maxlength argument. 
    31  
    32 >>> legacy_maxlength(0, None) 
    33 0 
    34  
    35 >>> legacy_maxlength(None, 0) 
    36 0 
    37  
    38 #=============================================================================== 
    39 # Fields 
    40 #=============================================================================== 
    41  
    42 # Set up fields 
    43 >>> from django.db.models import fields 
    44 >>> new = fields.Field(max_length=15) 
    45 >>> old = fields.Field(maxlength=10) 
    46  
    47 # Ensure both max_length and legacy maxlength are not able to both be specified 
    48 >>> fields.Field(maxlength=10, max_length=15) 
    49 Traceback (most recent call last): 
    50     ... 
    51 TypeError: Field cannot take both the max_length argument and the legacy maxlength argument. 
    52  
    53 # Test max_length 
    54 >>> new.max_length 
    55 15 
    56 >>> old.max_length 
    57 10 
    58  
    59 # Test accessing maxlength 
    60 >>> new.maxlength 
    61 15 
    62 >>> old.maxlength 
    63 10 
    64  
    65 # Test setting maxlength 
    66 >>> new.maxlength += 1 
    67 >>> old.maxlength += 1 
    68 >>> new.max_length 
    69 16 
    70 >>> old.max_length 
    71 11 
    72  
    73 # SlugField __init__ passes through max_length so test that too 
    74 >>> fields.SlugField('new', max_length=15).max_length 
    75 15 
    76 >>> fields.SlugField('empty').max_length 
    77 50 
    78 >>> fields.SlugField('old', maxlength=10).max_length 
    79 10 
    80  
    81 #=============================================================================== 
    82 # (old)forms 
    83 #=============================================================================== 
    84  
    85 >>> from django import oldforms 
    86  
    87 # Test max_length attribute 
    88  
    89 >>> oldforms.TextField('new', max_length=15).render('') 
    90 u'<input type="text" id="id_new" class="vTextField" name="new" size="30" value="" maxlength="15" />' 
    91  
    92 >>> oldforms.IntegerField('new', max_length=15).render('') 
    93 u'<input type="text" id="id_new" class="vIntegerField" name="new" size="10" value="" maxlength="15" />' 
    94  
    95 >>> oldforms.SmallIntegerField('new', max_length=15).render('') 
    96 u'<input type="text" id="id_new" class="vSmallIntegerField" name="new" size="5" value="" maxlength="15" />' 
    97  
    98 >>> oldforms.PositiveIntegerField('new', max_length=15).render('') 
    99 u'<input type="text" id="id_new" class="vPositiveIntegerField" name="new" size="10" value="" maxlength="15" />' 
    100  
    101 >>> oldforms.PositiveSmallIntegerField('new', max_length=15).render('') 
    102 u'<input type="text" id="id_new" class="vPositiveSmallIntegerField" name="new" size="5" value="" maxlength="15" />' 
    103  
    104 >>> oldforms.DatetimeField('new', max_length=15).render('') 
    105 u'<input type="text" id="id_new" class="vDatetimeField" name="new" size="30" value="" maxlength="15" />' 
    106  
    107 >>> oldforms.EmailField('new', max_length=15).render('') 
    108 u'<input type="text" id="id_new" class="vEmailField" name="new" size="50" value="" maxlength="15" />' 
    109 >>> oldforms.EmailField('new').render('') 
    110 u'<input type="text" id="id_new" class="vEmailField" name="new" size="50" value="" maxlength="75" />' 
    111  
    112 >>> oldforms.URLField('new', max_length=15).render('') 
    113 u'<input type="text" id="id_new" class="vURLField" name="new" size="50" value="" maxlength="15" />' 
    114 >>> oldforms.URLField('new').render('') 
    115 u'<input type="text" id="id_new" class="vURLField" name="new" size="50" value="" maxlength="200" />' 
    116  
    117 >>> oldforms.IPAddressField('new', max_length=15).render('') 
    118 u'<input type="text" id="id_new" class="vIPAddressField" name="new" size="15" value="" maxlength="15" />' 
    119 >>> oldforms.IPAddressField('new').render('') 
    120 u'<input type="text" id="id_new" class="vIPAddressField" name="new" size="15" value="" maxlength="15" />' 
    121  
    122 >>> oldforms.CommaSeparatedIntegerField('new', max_length=15).render('') 
    123 u'<input type="text" id="id_new" class="vCommaSeparatedIntegerField" name="new" size="20" value="" maxlength="15" />' 
    124  
    125  
    126 # Test legacy maxlength attribute 
    127  
    128 >>> oldforms.TextField('old', maxlength=10).render('') 
    129 u'<input type="text" id="id_old" class="vTextField" name="old" size="30" value="" maxlength="10" />' 
    130  
    131 >>> oldforms.IntegerField('old', maxlength=10).render('') 
    132 u'<input type="text" id="id_old" class="vIntegerField" name="old" size="10" value="" maxlength="10" />' 
    133  
    134 >>> oldforms.SmallIntegerField('old', maxlength=10).render('') 
    135 u'<input type="text" id="id_old" class="vSmallIntegerField" name="old" size="5" value="" maxlength="10" />' 
    136  
    137 >>> oldforms.PositiveIntegerField('old', maxlength=10).render('') 
    138 u'<input type="text" id="id_old" class="vPositiveIntegerField" name="old" size="10" value="" maxlength="10" />' 
    139  
    140 >>> oldforms.PositiveSmallIntegerField('old', maxlength=10).render('') 
    141 u'<input type="text" id="id_old" class="vPositiveSmallIntegerField" name="old" size="5" value="" maxlength="10" />' 
    142  
    143 >>> oldforms.DatetimeField('old', maxlength=10).render('') 
    144 u'<input type="text" id="id_old" class="vDatetimeField" name="old" size="30" value="" maxlength="10" />' 
    145  
    146 >>> oldforms.EmailField('old', maxlength=10).render('') 
    147 u'<input type="text" id="id_old" class="vEmailField" name="old" size="50" value="" maxlength="10" />' 
    148  
    149 >>> oldforms.URLField('old', maxlength=10).render('') 
    150 u'<input type="text" id="id_old" class="vURLField" name="old" size="50" value="" maxlength="10" />' 
    151  
    152 >>> oldforms.IPAddressField('old', maxlength=10).render('') 
    153 u'<input type="text" id="id_old" class="vIPAddressField" name="old" size="15" value="" maxlength="10" />' 
    154  
    155 >>> oldforms.CommaSeparatedIntegerField('old', maxlength=10).render('') 
    156 u'<input type="text" id="id_old" class="vCommaSeparatedIntegerField" name="old" size="20" value="" maxlength="10" />' 
    157 """ 
    158 if __name__ == "__main__": 
    159     import doctest 
    160     doctest.testmod() 
  • docs/model-api.txt

     
    144144(in characters) of the field. The max_length is enforced at the database level 
    145145and in Django's validation. 
    146146 
    147 Django veterans: Note that the argument is now called ``max_length`` to 
    148 provide consistency throughout Django. There is full legacy support for 
    149 the old ``maxlength`` argument, but ``max_length`` is preferred. 
    150  
    151147``CommaSeparatedIntegerField`` 
    152148~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    153149 
  • docs/pagination.txt

     
    135135``number`` -- The 1-based page number for this page. 
    136136 
    137137``paginator`` -- The associated ``Paginator`` object. 
    138  
    139 The legacy ``ObjectPaginator`` class 
    140 ==================================== 
    141  
    142 The ``Paginator`` and ``Page`` classes are new in the Django development 
    143 version, as of revision 7306. In previous versions, Django provided an 
    144 ``ObjectPaginator`` class that offered similar functionality but wasn't as 
    145 convenient. This class still exists, for backwards compatibility, but Django 
    146 now issues a ``DeprecationWarning`` if you try to use it. 
  • docs/cache.txt

     
    159159 
    160160    CACHE_BACKEND = 'locmem:///' 
    161161 
    162 Simple caching (for development) 
    163 -------------------------------- 
    164  
    165 A simple, single-process memory cache is available as ``"simple:///"``. This 
    166 merely saves cached data in-process, which means it should only be used in 
    167 development or testing environments. For example:: 
    168  
    169     CACHE_BACKEND = 'simple:///' 
    170  
    171 **New in Django development version:** This cache backend is deprecated and 
    172 will be removed in a future release. New code should use the ``locmem`` backend 
    173 instead. 
    174  
    175162Dummy caching (for development) 
    176163------------------------------- 
    177164 
  • docs/sessions.txt

     
    6565.. note:: 
    6666 
    6767    You should probably only use cache-based sessions if you're using the 
    68     memcached cache backend. The local memory and simple cache backends 
    69     don't retain data long enough to be good choices, and it'll be faster 
    70     to use file or database sessions directly instead of sending everything 
    71     through the file or database cache backends. 
     68    Memcached cache backend. The local-memory cache backend doesn't retain data 
     69    long enough to be a good choice, and it'll be faster to use file or 
     70    database sessions directly instead of sending everything through the file 
     71    or database cache backends. 
    7272 
    7373Using sessions in views 
    7474=======================