[Moin-user] Error message for Macro input errors.

Frank Lin PIAT fpiat at klabs.be
Fri May 1 11:03:00 EDT 2009


On Fri, 2009-05-01 at 16:40 +0200, Thomas Waldmann wrote:
> > I am writing a macro which needs some arguments. I wonder if it is
> > possible to detect if the page is being previewed?
> > I would display error message in preview mode, but silently ignore
> > errors when the page is viewed by a regular user?
> 
> Interesting idea, but after thinking about it, I don't think one really
> wants that. An error should show as long as until it is fixed. Otherwise
> some not carefully looking (or not previewing at all) editor will
> introduce errors and noone will see and fix them.

That would have been useful, for the situation where the macro can
degrade properly (i.e ignore the value and/or provide a reasonable
default).

For example, my macro builds a sidebar with some standard user
information in Debian
http://wiki-debian-net.klabs.be/User/JohnDoe
source is:
http://wiki-debian-net.klabs.be/-plugin/macro/DebianPortfolio.py

The macro accepts a lot of optional parameters. Actually I have
implemented a built-in help, that can be displayed with:
  <<DebianPortfolio(showhelp=yes)>>
see the bottom of  http://wiki-debian-net.klabs.be/DebianPortfolioMacro

So for example:
* All fields are optional. Still I would print the help when all 
  the fields are empty.
* The email is important, but not compulsory.
* I might want to add some other important fields later... And warn the
  user when he/she edits the page, but not visitors.

Regards,

Franklin





More information about the Moin-user mailing list