Ticket #24487: 0001-Add-guidance-for-the-disappearance-of-SortedDict.patch

File 0001-Add-guidance-for-the-disappearance-of-SortedDict.patch, 1.6 KB (added by pascal chambon, 10 years ago)

Doc update to workaround the disappearance of SortedDict

  • docs/releases/1.7.txt

    From 5c5ca08b237ad87e97108b0e1fc727e49e646a00 Mon Sep 17 00:00:00 2001
    From: Pakal <chambon.pascal@gmail.com>
    Date: Tue, 17 Mar 2015 15:25:07 +0100
    Subject: [PATCH 2/2] Add guidance for the disappearance of SortedDict.
    
    ---
     docs/releases/1.7.txt | 18 ++++++++++++++++++
     1 file changed, 18 insertions(+)
    
    diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
    index 72e8bbe..fd3ab87 100644
    a b Python versions, this module isn't useful anymore. It has been deprecated. Use  
    15121512As :class:`~collections.OrderedDict` was added to the standard library in
    15131513Python 2.7, ``SortedDict`` is no longer needed and has been deprecated.
    15141514
     1515This means that the two additional methods provided by ``SortedDict``, i.e
     1516``insert`` and ``value_for_index``, do not exist anymore.
     1517
     1518If you relied on these methods to alter structures like form fields, you
     1519should now consider treating these ordered dicts as immutable objects, and
     1520override them to change their content.
     1521
     1522For example, you might want to override ``MyFormClass.base_fields`` to change
     1523the ordering of fields for all ``MyFormClass`` instances ; or similarly, you
     1524could override ``self.fields`` from inside ``MyFormClass.__init__``, to change
     1525the fields for a particular form instance. Example from the django codebase::
     1526
     1527    PasswordChangeForm.base_fields = OrderedDict(
     1528    (k, PasswordChangeForm.base_fields[k])
     1529    for k in ['old_password', 'new_password1', 'new_password2']
     1530    )
     1531
     1532   
    15151533Custom SQL location for models package
    15161534~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    15171535
Back to Top