[MAGNOLIA-3304] Renderer doesnt restore the model attribute after rendering is done Created: 23/Sep/10 Updated: 01/Dec/10 Resolved: 15/Nov/10 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | templating |
| Affects Version/s: | 4.3.6 |
| Fix Version/s: | 4.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Tobias Mattsson | Assignee: | Tobias Mattsson |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | model, rendering, templating | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
Before rendering AbstractRenderer.saveContextState() takes a snapshot of the values it will change, but this doesnt include "model". Then AbstractRenderer.setupContext() sets "model", afterwards the snapshot is used to restore the attributes but this doesnt include "model". Reported on the user list by Stein Kvarud <stein.kvarud@iterate.no> Original description: Hi. I discovered some sideeffects with the way magnolia does paragraph I have created a small sample to illustrate the problem. Creating two custom RenderingModels for a template and a paragraph public class MyTemplateRenderingModel extends public MyTemplateRenderingModel(Content content, public String getClassName(){ return this.getClass().getName(); } } public class MyParagraphRenderingModel extends RenderingModelImpl<RenderableDefinition> { public MyParagraphRenderingModel(Content content, RenderableDefinition definition, RenderingModel<?> parent) { super(content, definition, parent); } public String getClassName() { return this.getClass().getName(); }} Then adding two smal jsp files The template: Model value before loading paragraphs = ${model.className} <cms:contentNodeIterator contentNodeCollectionName="testCollection"> Model value after loading paragraphs = ${model.className} The paragraph: <p> Then I add a modelClass for the paragraph and the template in the Before adding any paragraphs to the template it displays Model value before loading paragraphs = MyTemplateRenderingModel I then add one (or more) paragraphs As the example illustrates the final output from model.className Do I need to add some tag to the jsp to avoid this sideeffect or is this a bug? Regards |
| Comments |
| Comment by Tobias Mattsson [ 01/Dec/10 ] |
|
The fix was in r39093 |
| Comment by Jan Haderka [ 01/Dec/10 ] |
|
changes for |