On 4/28/06, Michael Radziej <[EMAIL PROTECTED]> wrote:
> I started to track this down, found that while constructing the sql
> clause, None values are deliberately ignored.
>
> In db.models.query, function parse_lookup() walks through the kwargs and
> tests:
>
> for kwarg, value in kwarg_items:
> if value is not None:
>
> - there is no else!
>
> I'd have expected that the where clause were "id==NULL".
>
> It would be easy to patch, but this really looks as if this was
> intended. But why? For me, it looks like unexpected bad magic ...
That's a relic from the pre-dynamic Django database API, when we
manually wrote our own get_list() functions like this:
def get_list(name=None, id=None, pub_date=None):
if name is not None:
lookup = 'name = %s'
# ...
I'm all for removing it at this point in magic-removal.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---