Hi Matt,

2013/9/12 Matt Austin <m...@mattaustin.me.uk>

> I discovered today that unless timezone data is loaded in to mysql, then
> previously working (although functionally broken) week_day lookups return
> an empty queryset.
>
> I couldn't find notes in the docs (release notes or queryset week_day
> docs) that mention this requirement - but happened to read the docs for the
> new datetimes() behaviour and then discovered how to load tzinfo in to
> mysql.
>
> I filled a ticket to update the docs:
> https://code.djangoproject.com/ticket/21095
>

Thanks for filing this ticket. I noticed it this morning and planned to
investigate it.

Can you confirm that your project has the USE_TZ setting set to True?


> I am happy to contribute modifications to the docs - but before I do, I
> thought it might be worth seeing if this is the correct approach.
>
> Should an empty list be the desired behaviour, should an exception be
> raised, or should the old behaviour (which doesn't honour timezones) be
> maintained when tzinfo is not available?
>

I believe I introduced it with a patch that made the date lookups (__year,
__month, __day, __week_day) take the time zone into account. Previously
they would consider the date in UTC when USE_TZ = True, which returned
incorrect results. Since this was a bugfix, I didn't mention it in the
release notes.

I didn't realize it was a backwards-incompatible change, considering that
"no results at all" is much worse than "results off by a few hours". (On a
side note, I love MySQL's helpful error handling.)

The solution is indeed to add a paragraph describing this backwards
incompatibility in the release notes, as well as a warning in the docs for
the date lookups if there's not one already (IIRC there is).

The problem probably affects all four date lookups. If you have time to
test this, it would help.

Thanks again,

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to