Changes between Version 165 and Version 166 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
Jun 26, 2008, 10:36:41 PM (16 years ago)
Author:
Malcolm Tredinnick
Comment:

documented internal where-node changes in 7773.

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v165 v166  
    5656 * [7477] April 27, 2008 [#Queryset-refactormerge Queryset-refactor merge]
    5757 * [7574] June 4, 2008 [#TightenedupForeignKeyassignment Tightened up ForeignKey assignment]
     58 * [7773] June 26, 2008 [#ChangedWhereNodeinternals Changed Where node internals]
    5859
    5960== Database constraint names changed ==
     
    601602  * Raise a {{{ValueError}}} if you try to assign {{{None}}} to a field not specified with {{{null=True}}}.
    602603  * Cache the set value at set time instead of just at lookup time. This avoids race conditions when saving related objects along with their parents and was the original impetus for the change (see #6886).
     604
     605== Change Where node internals ==
     606For anybody writing custom Q-like objects or advanced filter additions with the !QuerySet class, [7773] changed the information that is passed to the Where class by default. A standard leaf node in the Where class used to be
     607
     608{{{
     609#!python
     610[table_alias, field_name, field_instance, lookup_type, value]
     611}}}
     612
     613This changeset removed the need to store any field instances (in `field_instance`) or model references (in the `value`). The new list in the leaf nodes is now
     614
     615{{{
     616#!python
     617[table_alias, field_name, db_type, lookup_type, value_annotation, params]
     618}}}
     619
     620The `db_type` is the result of `field.db_type()` or `None` if `field` was None previously. The `value_annotation` is usually `bool(value)`, but it is `datetime.datetime` if the previous `value` was a datetime. Finally, `params` is the result of `value.db_prep_lookup()` or equivalent and must be a sequence (so if you're passing in a value directly, wrap it in a list or a tuple).
     621
     622Again, this will not affect most code, but people writing customised things will need to adjust. Fortunately, since the list is now one component longer, if you miss a change, your code will fail drastically so you will notice.
Back to Top