learning-unlimited/ESP-Website — Issue #237: Cache inclusion tag doesn't see new TemplateOverride
Author: pteromys
Created: 2012-01-12 04:36:07+00:00
State: open
Labels: NeedsReproducer

If I save a TemplateOverride for the template used by a `cache_inclusion_tag`, the cache inclusion tag doesn't update automatically. For example, I had to run the following in a Django shell to make the dashboard's class list use a new override.

```python
# Import stuff
from django.template.loader import get_template_from_string
from esp.program.templatetags.class_manage_row import render_class_row
from esp.program.models import Program
# It turned out to be somewhat tricky to get an instance of InclusionNode.
t = get_template_from_string('{% load class_manage_row %}{% render_class_row cls program %}')
# In theory this shouldn't be necessary...
t.nodelist[1].render_given_args.delete_all()
# ...but deleting the following cache alone didn't reset the preceding (which depends on the following).
render_class_row.cached_function.delete_all()
# Just for good measure
Program.getModules_cached.delete_all()
```

I still don't know why it was necessary to reset `render_given_args`; it's supposed to depend on the function being decorated. Perhaps a test case for `cache_inclusion_tag` might help us figure out what's going on here.