Ticket #191 (closed enhancement: fixed)
provide fallback in case variable loading faces 40x
| Reported by: | mpo | Owned by: | mpo |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.4 |
| Component: | modules/kauri-template | Version: | trunk |
| Keywords: | Cc: |
Description
The construct:
<t:variable src="module:/path/something.json" />
currently fails the complete template if the path cannot be found.
It would be nice if it could be more silent about this and made to fallback to some default or 'undefined/null' value for further testing in the template.
Attachments
Change History
comment:2 Changed 2 years ago by mpo
Proposal:
- foresee a @fallback expression that can produce a default value in case the src load fails
- resort to exception throwing like today if src fails and no @fallback is given
Work to be done VariableBlock?.java in universe/kauri-template
comment:3 Changed 2 years ago by mpo
Just added a patch implementing this without introducing a new attribute.
Looking at the code I had the impression we could just let @src overwrite what @value or the nested block where doing already. This patch does that:
- first expand the @value or interpret the nested block if no @value was present
- then allow that 'fallback' be overwritten by loading data from @src
- only throw an exception if still no data is returned
Didn't find any tests conflicting with this new behaviour, but the patch includes an extension of the tests to check for the new approach.
Haven't committed straight on 'cause I wanted to give you some time for feedback.
comment:4 Changed 2 years ago by mpo
Committed the patch after discussion with Jeroen in r1436.
TODO: add documentation (waiting to close the ticket)
comment:5 Changed 20 months ago by freya
- Owner changed from jgou to mpo
- Status changed from new to assigned
comment:6 Changed 19 months ago by mpo
- Status changed from assigned to closed
- Resolution set to fixed
documentation added to http://www.kauriproject.org/docs-0_4/195-kauri/g2/263-kauri.html
some relation to #41