Modul:Protection banner: Unterschied zwischen den Versionen
use pipes as separators instead of hyphens for the protection category keys and validate reasons when we create the protection object to make sure they don't contain pipes
(just pass the args through to the /config functions - that means the /config functions can use arbitrary parameters without them having to be specified in the main module) |
(use pipes as separators instead of hyphens for the protection category keys and validate reasons when we create the protection object to make sure they don't contain pipes) |
||
Zeile 122: | Zeile 122: | ||
if args[1] then | if args[1] then | ||
self.reason = mw.ustring.lower(args[1]) | self.reason = mw.ustring.lower(args[1]) | ||
if self.reason:find('|') then | |||
error('reasons cannot contain the pipe character ("|")', 0) | |||
end | |||
end | end | ||
Zeile 281: | Zeile 284: | ||
end | end | ||
end | end | ||
key = table.concat(key, ' | key = table.concat(key, '|') | ||
local attempt = cats[key] | local attempt = cats[key] | ||
if attempt then | if attempt then |