Changes between Initial Version and Version 4 of Ticket #14786


Ignore:
Timestamp:
02/04/2012 04:12:16 PM (4 years ago)
Author:
lrekucki
Comment:

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

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14786

    • Property Severity changed from to Normal
    • Property Cc jonash added
    • Property Patch needs improvement set
    • Property Needs tests unset
    • Property Version changed from 1.2 to SVN
    • Property Easy pickings unset
    • Property Keywords sprintdec2010 fields lookup added
    • Property Needs documentation unset
    • Property Has patch set
    • Property UI/UX unset
    • Property Type changed from to Bug
    • Property Triage Stage changed from Unreviewed to Accepted
  • 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