Changes between Initial Version and Version 4 of Ticket #14786


Ignore:
Timestamp:
Feb 4, 2012, 4:12:16 PM (13 years ago)
Author:
Łukasz Rekucki
Comment:

Patch doesn't apply cleanly, will try to rebase.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14786

    • Property Cc Jonas H. added
    • Property Has patch set
    • Property Keywords sprintdec2010 fields lookup added
    • Property Triage Stage UnreviewedAccepted
    • Property Version 1.2SVN
    • Property SeverityNormal
    • Property TypeBug
    • Property Easy pickings unset
    • Property Patch needs improvement set
    • Property UI/UX unset
  • Ticket #14786 – Description

    initial v4  
    1 In db.models.fields.Field ''get_db_prep_lookup()'' check if value is prepared and prepare it:
    2 {{{
     1In db.models.fields.Field {{{get_db_prep_lookup()}}} check if value is prepared and prepare it:
     2
     3{{{#!python
    34def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False):
    45    "Returns field's value prepared for database lookup."
     
    67        value = self.get_prep_lookup(lookup_type, value)
    78}}}
    8 ''get_prep_lookup()'' call ''get_prep_value()'' for every value.
     9{{{get_prep_lookup()}}} call {{{get_prep_value()}}} for every value.
    910
    1011But look next:
    11 {{{
     12{{{#!python
    1213elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte'):
    1314    return [self.get_db_prep_value(value, connection=connection, prepared=prepared)]
     
    1516    return [self.get_db_prep_value(v, connection=connection, prepared=prepared) for v in value]
    1617}}}
    17 Prepared flag not changed and ''get_db_prep_value()'' call ''get_prep_value()'' through ''get_db_prep_value()'' again!
     18Prepared flag not changed and {{{get_db_prep_value()}}} call {{{get_prep_value()}}} through {{{get_db_prep_value()}}} again!
    1819
    19 I think ''get_db_prep_lookup()'' should call ''get_db_prep_value()'' always with prepared == True.
    20 {{{
     20I think {{{get_db_prep_lookup()}}} should call {{{get_db_prep_value()}}} always with {{{prepared == True}}}.
     21{{{#!python
    2122elif lookup_type in ('exact', 'gt', 'gte', 'lt', 'lte'):
    2223    return [self.get_db_prep_value(value, connection=connection, prepared=True)]
     
    2526}}}
    2627
    27 This bug is still unnoticed because in standard ORM ''get_db_prep_lookup()'' always calls with prepared == True.
     28This bug is still unnoticed because in standard ORM {{{get_db_prep_lookup()}}} always calls with {{{prepared == True}}}.
Back to Top