Changes between Initial Version and Version 1 of Ticket #23516, comment 3
- Timestamp:
- Sep 18, 2014, 7:21:15 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #23516, comment 3
initial v1 10 10 you'll see failures in both 1.6 and 1.7. 11 11 12 The problem is that `IfChangedNode` stores what it looked like last time in the context by setting it as `state_frame[self]`. We were only getting the right thing in 1.6 because it was using `ConstantIncludeNode`, which calls `get_template` in its `__init__()`. With a normal `IncludeNode`, which is all there is in 1.7, `get_template` is called in `render()` causing a new `IfChangedNode` object. When the new `IfChangedNode` is looked up inas `state_frame[self]` it's not the same `self`!12 The problem is that `IfChangedNode` stores what it looked like last time in the context by setting it as `state_frame[self]`. We were only getting the right thing in 1.6 because it was using `ConstantIncludeNode`, which calls `get_template` in its `__init__()`. With a normal `IncludeNode`, which is all there is in 1.7, `get_template` is called in `render()` causing a new `IfChangedNode` object. When the new `IfChangedNode` is looked up as `state_frame[self]` it's not the same `self`! 13 13 14 14 Now I understand the problem, but I'm still not sure I have a solution. Perhaps `IfChangedNode` could be made to produce the same object rather than a new copy under the right circumstances, or perhaps we should store the previous version to compare to in `state_frame` using something other than `self` as the key.