Module:Protection banner: Difference between revisions
Content added Content deleted
Enwikipedia>Mr. Stradivarius (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) |
Enwikipedia>Mr. Stradivarius (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) |
||
Line 122: | Line 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 |
||
Line 281: | Line 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 |