Opened 11 years ago
Last modified 11 years ago
#24381 closed Bug
Cache pickling exception in 1.8a1 with cross-table filter params — at Version 3
| Reported by: | Mark Tranchant | Owned by: | nobody | 
|---|---|---|---|
| Component: | Core (Cache system) | Version: | 1.8alpha1 | 
| Severity: | Release blocker | Keywords: | cache pickle empty queryset | 
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description (last modified by )
In 1.7.4, I can run the following transcript in ../manage.py shell. The Contributor model has two ForeignKeys, to MyModel and Task, so I'm looking up all MyModels which have a referring contributor associated with task 4.
>>> from MyProject.models import *
>>> from django.core.cache import cache
>>> cl = MyModel.objects.filter(contributor__task__id=4)
>>> cl
<<< []
>>> type(cl)
<<< django.db.models.query.QuerySet
>>> cache.set('testing', cl)
>>> cache.get('testing')
<<< []
In 1.8a1, the cache set operation generates an exception. See attachment for trace.
PicklingError: Can't pickle <type 'module'>: it's not found as __builtin__.module
If I try to cache a simple empty QuerySet (MyModel.objecrts.filter(id=0), for example), it works.
Change History (4)
by , 11 years ago
| Attachment: | pickling-error.txt added | 
|---|
comment:1 by , 11 years ago
| Summary: | Cache pickling issue in 1.8a1 → Cache pickling exception in 1.8a1 | 
|---|
comment:2 by , 11 years ago
| Description: | modified (diff) | 
|---|
comment:3 by , 11 years ago
| Description: | modified (diff) | 
|---|---|
| Summary: | Cache pickling exception in 1.8a1 → Cache pickling exception in 1.8a1 with cross-table filter params | 
  Note:
 See   TracTickets
 for help on using tickets.
    
Exception trace