TWiki::UI::Save::buildNewTopic needs the same fix that was applied to TWiki::UI::Edit::edit (see Item1939)
With this fix applied, further problems come to light. As pointed out by the comments in the code, if a non-wikiname is specified (and onlywikiname is true),
UI::Save::buildNewTopic
should throw an exception; instead it generates a redirect and returns 0. But,
UI::Save::save
, which calls
buildNewTopic
expects an exception on error, so doesn't notice that the return isn't what it expects, and blithely goes ahead and saves the topic. Ooops.
TWiki:Main.DiabJerius
Well, the above analysis is correct, but the behavior exists regardless of applying the suggested fix.
I've attached a patch which
- makes
save
recognize the nonwikiword
parameter correctly
- makes
save
and edit
throw an Oops if a non-wikiword is disallowed but one is passed
- supplies an appropriate template message for the Oops
It does not implement the tests alluded to in
messages.tmpl
as I'm not familiar with them.
TWiki:Main.DiabJerius
Diab, many thanks for the patch, which I used to guide me through applying changes.
As for not updating testcases "because you are not familiar with them",
wash your mouth out with soap. Testcases are the lifeblood of any complex software project. If you want to raise quality, and I am sure you do, you will not ignore testcases, you will do everything in your power to make sure they are updated and run! Grrr.
CC
Oh, I have no objection to writing tests; I seem to spend most of my time creating and populating test frameworks for my own software. It's even fun sometimes.
I meant that I'm not familiar with the test framework that TWiki uses. I don't have the time right now to figure it out, so take my admission more as an apology and explanation for my not doing the job properly rather than as a rejection of the testing philosophy.
(As an aside, if you've ever seen the movie "A Christmas Story", you'd never threaten anyone with washing their mouth out with soap. It's a bit of a cult classic in the USA; don't know if it's available elsewhere.)
TWiki:Main.DiabJerius