learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
84 stars 57 forks source link

PersistentQueryFilter created with q_filter that won't unpickle #1961

Open mgersh opened 8 years ago

mgersh commented 8 years ago

I created a combination list, with the base list 'teachers teaching an approved class' and added 'AND NOT teachers who have taught for a previous program'. Then I opened a shell and tried to unpickle the corresponding PQF's q_filter, and got an error. It's the PQF with id 11616 on MIT's site.

benjaminjkraft commented 8 years ago

This appears to be an issue caused by having a class title with non-ASCII in it. I'm surprised we haven't encountered it before; it's possible it's a regression in django. To repro (C9599 has a "ö" in its title):

print Q(classsubject__in=ClassSubject.objects.filter(id=9599))
benjaminjkraft commented 8 years ago

In particular, this isn't actually an error in depickling. You can depickle the Q object just fine; it's printing/repring it afterwards that causes the error.

benjaminjkraft commented 8 years ago

I think this is a django bug. I'm going to look into it more sometime not-now, but until such time:

benjaminjkraft commented 8 years ago

Whoops, not-now turned out to be now -- Django bug reported: https://code.djangoproject.com/ticket/25875. The fix should be simple enough assuming nothing unexpected breaks; I'm not entirely sure if they'll want to backport it to 1.8, though.

benjaminjkraft commented 8 years ago

BTW, this was not backported, so if we want to fix this before django 1.10, we'll have to either work around it or just ignore it.