Question
Following a suggestion from
SvenDowideit in my question:
HowToUseTWikiFuncGetCgiQuery I have attempted to write a REST handler.
Specifically what I did you can see here:
http://bram.van-oosterhout.org/twiki/bin/view/Sandbox/TestTopic1
I got it to work and feel quite pleased with myself. but I had to use undocumented features like:
- using TWiki::UI::run instead of a TWiki::Func interface
- using $session->{cgiQuery}; instead of TWiki::Func::getCgiQuery();
Is there a better way?
Separately, I found the rest interface works fine, but the &topic=myTopic parameter in a http invocation creates an odd result. Change &thetopic to &topic in the following url:
http://bram.van-oosterhout.org/twiki402/bin/rest/TestPlugin/example?theweb=myWeb&thetopic=myTopic&method=topic&major=test&minor=test&debug=1
It appears to be taken as a special value. Is that intended?
regards....
Update 20 November
I found subsequently that other calls to TWiki::Func don't work either.
I solved that with:
sub restExample {
my ($session) = @_;
$TWiki::Plugins::SESSION = $session;
...
That helps, but some calls still don't work. In particular:
TWiki::Func::getSkin();
returns pattern, although the skin for the web is set as Rollout.
Clearly there is no way for the code (SESSION??) to know what web I want. The web is defined in a cgi param named
theweb. How can I tell getSkin which web I want the skin for. How can I tell getSkin which web I am referring to? Or should I get the SKIN variable myself using
getPreferencesValue( $key, $web )?
regards...
Environment
--
BramVanOosterhout - 19 Nov 2006
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
you may well have uncovered a real bug - although last time i made a restHandler, I did not have these issues. The TWiki::Func API
should work for you, and certainly used to.
--
SvenDowideit - 21 Nov 2006
Sorry, closing this question after more than 30 days. Feel free to file a bug report...
--
PeterThoeny - 29 Dec 2006