This is actually a limitation of the Func API: you can't use
TWiki::Func::getOopsUrl()
to generate an
accessdenied
message
as this needs an extra
def => 'topic_access'
parameter. And this is not part of the calling interface. So infact anything in
message.tmpl
can't be called by a
TWiki::Func::getOopsUrl()
.
Admitted, you are supposed to throw an access denied exception instead of creating a redirect of its own. But the current
rest
script does not catch exceptions and thus generates an internal server error if you throw an exception.
So there are three ways to fix this all:
- enhance the Func API to allow a
def
parameter
- i think this is the appropriate long term solution - CC
- catch exceptions in the
rest
script and redirect to the appropriate oops url from in there
- This is not an option, as REST code is not UI code. there is no guarantee that a REST handler will terminate with a redirect or page display. For example, an XmlHttpRequest really doesn't want to get answered with a redirect. - CC
- you could still
try ... catch
exceptions in order to prevent an internal server error message and generate some sort of return message that can be processed by the caller - MD
- bypass the Func API in the EditRowPlugin rest handler
- This is a stop-gap at best. - CC
I went with (3) for now.
--
TWiki:Main/MichaelDaum
- 16 Mar 2007
As described above, the bug is in the Func API which doesn't give access to the whole functionality of getOopsUrl.
CC
Bigger job than i anticipated, but it's a bit cleaner now and I was able to delete another function from TWiki.pm
CC
Part of SVN 13287 was a deprecation of a Func API function.
How can a official API be deprecated without a release meeting decision?
This is not the first time this is pointed out. I am not saying I am against but people should have a chance to evaluate and make a qualified decision.
The following plugins are affected by the deprecation
See
TWiki:Codev.DeprecateTWikiFuncGetOopsUrl
for discussion.
--
TWiki:Main.KennethLavrsen
- 07 Apr 2007
The solution is to deprecate
getOopsUrl
and use
getScriptUrl
instead. Documented, deprecated the
getOopsUrl
function and added unit test for the deprecated function.
CC