r10 - 03 Feb 2005 - 08:43:57 - AndreUlrichYou are here: TWiki >  Codev Web > TopicVariablesInNestedInclusions
Tags:
, create new tag

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
Include Level TESTVARIABLE Expected Topic Name
Including topic Level-Start Level-Start TopicVariablesInNestedInclusions

  • Set TESTVARIABLE = LEVEL-1
Include Level TESTVARIABLE Expected Topic Name Including Topic Rev Info
1st level include Level-Start LEVEL-1 IncludeTest TopicVariablesInNestedInclusions? r4 - 01 Feb 2005 - 13:52:19 - OliverKrueger

  • Set TESTVARIABLE = LEVEL-2
Include Level TESTVARIABLE Expected Topic Name Including Topic Rev Info
2nd level include Level-Start LEVEL-2 IncludeTest2 IncludeTest r3 - 01 Feb 2005 - 13:53:48 - OliverKrueger

  • Set TESTVARIABLE = LEVEL-3
Include Level TESTVARIABLE Expected Topic Name Including Topic Rev Info
3rd level include Level-Start LEVEL-3 IncludeTest3 IncludeTest2 r3 - 01 Feb 2005 - 13:54:20 - OliverKrueger

  • Set TESTVARIABLE = LEVEL-4
Include Level TESTVARIABLE Expected Topic Name Including Topic Rev Info
4th level include Level-Start LEVEL-4 IncludeTest4 IncludeTest3 r3 - 01 Feb 2005 - 13:54:59 - OliverKrueger


Include Level TESTVARIABLE Expected Topic Name
back in including topic Level-Start Level-Start TopicVariablesInNestedInclusions

-- 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

 
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r10 < r9 < r8 < r7 < r6 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo