Topic Variables in Nested Inclusions
Normally you can inherit a user defined topic variable to an included topic. This behavior fails if you are on level two (and the following) of an inclusion chain. I think introducing a variable and passing that variable to the included topic should not work only on the top-level. Therefore I added a
Prefs::getPrefsFromTopic call to
TWiki::handleIncludeFile, which solves the problem, but I am not quite sure, what sideeffects may occur. Diff attached.
Testcase
(in
Sandbox.IncludeTest)
- Set TESTVARIABLE = Level-Start
- Set TESTVARIABLE = LEVEL-1
- Set TESTVARIABLE = LEVEL-2
- Set TESTVARIABLE = LEVEL-3
- Set TESTVARIABLE = LEVEL-4
--
OliverKrueger - 01 Feb 2005
I can't see how this would be useful. And it would break current uses of included topics with variable definitions like
ReleaseQueuesInsert.
--
SamHasler - 01 Feb 2005
The behaviour would be "orthogonal" to the existing variables(topic,includingtopic,revnumber...), which also reflect the local setting within the included topic.
ReleaseQueuesInsert break, because you inserted INCLUDINGTOPIC by hand, althought the topic was made for working by inclusion.
--
AndreUlrich - 01 Feb 2005
I needed to define INCLUDINGTOPIC in
ReleaseQueuesInsert for testing. To remove that functionality would disallow a whole class of applications. Whereas I've yet to see a real world example of how this could be used that can't be achieved as easily by other means.
- I can understand that you need INCLUDINGTOPIC for testing, but this should be no con to an unexpected behaviour. -- AndreUlrich - 03 Feb 2005
--
SamHasler - 01 Feb 2005
This proposed change would definitely break many existing apps that rely on a global per topic setting.
If you need the functionality of a per included topic setting you can use
SpreadSheetPlugin's
$SET() and
$GET()
--
PeterThoeny - 03 Feb 2005
Are there any real world examples out there, where you rely on that kind of behaviour? (Test scenarious excluded)
With this proposed change you still can set variables in a global manner. But it will override the global setting, with the more local one if it was set within the topic. This behaviour is the same like all other things TWiki bring with. ALLOWWEBVIEW is an example and variables like
$topic also get changed in local context when topics are included or searched for.
--
AndreUlrich - 03 Feb 2005