Tags:
create new tag
, view all tags
There is no standard way to extract a web/topic name pair from a string; some uses expand MAINWEB and TWIKIWEB, some use different defaults for the web, and plugins are even worse. This caused a "bug", because a user reasonably expected a %MAINWEB expansion but didn't happen.

The proposal here is to:

  1. Publish normalizeWebTopicName via the func interface, so that plugins can benefit from the default
  2. Standardise usage throughout the TWiki code

Spec from FuncDotPm:

---+++ normalizeWebTopicName($web, $topic) -> ($web, $topic)

| Description: | Parse a web and topic name, supplying defaults as appropriate. |
| Parameter: =$web= | Web name, identifying variable, or empty string |
| Parameter: =$topic= | Topic name, may be a web.topic string, required. |
| Return: | the parsed Web/Topic pair.
| Since: | TWiki::Plugins::VERSION 1.026 |

| *Input* | *Return* |
| <tt>( "Web",  "Topic" )     </tt> | <tt>( "Web",  "Topic" ) </tt> |
| <tt>( "",     "Topic" )     </tt> | <tt>( "Main", "Topic" ) </tt> |
| <tt>( "",     "" )          </tt> | <tt>( "Main", "WebHome" ) </tt> |
| <tt>( "",     "Web/Topic" ) </tt> | <tt>( "Web",  "Topic" ) </tt> |
| <tt>( "",     "Web.Topic" ) </tt> | <tt>( "Web",  "Topic" ) </tt> |
| <tt>( "Web1", "Web2.Topic" )</tt> | <tt>( "Web2", "Topic" ) </tt> |
| <tt>( "%MAINWEB%", "Topic" )</tt> | <tt>( "Main", "Topic" ) </tt> |
| <tt>( "%TWIKIWEB%", "Topic" )</tt> | <tt>( "TWiki", "Topic" ) </tt> |
where =Main= and =TWiki= are the web names set in $cfg{UsersWebName} and $cfg{SystemWebName} respectively.

Done in DevelopBranch r3717

-- CrawfordCurrie - 28 Feb 2005

Good reasoning Crawford.

-- PeterThoeny - 01 Mar 2005

 
Topic revision: r2 - 2005-03-01 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.