pythonmysqldjangozinnia

Zinnia returned an invalid value in QuerySet.datetimes() with MySQL backend


I've done this, and this and followed the docs in this area, but I'm still getting the error. I've no idea how to debug it. Traceback at the end.

Update: Using a MySQL backend is the culprit. SQLite3 is fine, but the query data passed into the django backend MySQL compiler code returns nothing, and when executed on its own, returns an error. Anyone else have this issue and is there a workaround, or have I got this competely wrong?

Steps to reproduce:

Use MySQL as database.

Access the following view:

from zinnia.views.archives import EntryIndex
url(r'^testing',
        EntryIndex.as_view(),
        name='zinnia_entry_archive_index'),

Input a weblog.

Refresh the view.

Boom.

File "/opt/envs/django16/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
  return self.dispatch(request, *args, **kwargs)
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
return handler(request, *args, **kwargs)
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/dates.py", line 333, in get
  self.date_list, self.object_list, extra_context = self.get_dated_items()
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/dates.py", line 415, in get_dated_items
  date_list = self.get_date_list(qs, ordering='DESC')
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/dates.py", line 394, in get_date_list
  if date_list is not None and not date_list and not allow_empty:
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/db/models/query.py", line 100, in __nonzero__
self._fetch_all()
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/db/models/query.py", line 857, in _fetch_all
  self._result_cache = list(self.iterator())
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1113, in results_iter
raise ValueError("Database returned an invalid value "

Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?

I've traced this down to zinnia.views.archives.EntryIndex.as_view, but can't see what's going on yet. Anyone has any ideas? I'm running zinnia 0.14.1


Solution

  • This link.

    In short, you need to manually load the timezone information and the problem is solved. The unknown timezone was the issue.