diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2015-09-17 10:45:53 +0300 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2015-09-17 11:02:13 +0300 |
commit | edc58332f0bc93a637d1b44689849e9cef29596d (patch) | |
tree | eebd679ebc38ca4416deeb8a688a2ce0ad7f10f2 /applications/luci-app-firewall/luasrc/model | |
parent | f3f0de3e5eaaf7af727f1708b6d20b9ad6b10507 (diff) |
luci-app-firewall: use maxlength datatype instead of validate function
Switch the zonename validation to use
a compound datatype "and(uciname,maxlength(14))"
instead of a separate 'validate' function.
Remove the unnecessary function that was introduced by 34e875b
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Diffstat (limited to 'applications/luci-app-firewall/luasrc/model')
-rw-r--r-- | applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua b/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua index 46b3744403..6c90476f81 100644 --- a/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua +++ b/applications/luci-app-firewall/luasrc/model/cbi/firewall/zone-details.lua @@ -60,7 +60,7 @@ s:tab("advanced", translate("Advanced Settings")) name = s:taboption("general", Value, "name", translate("Name")) name.optional = false name.forcewrite = true -name.datatype = "uciname" +name.datatype = "and(uciname,maxlength(14))" function name.write(self, section, value) if zone:name() ~= value then @@ -76,15 +76,6 @@ function name.write(self, section, value) } end -function name.validate(self, value) - -- fw3 defines 14 as the maximum length of zone name - if #value > 14 then - return nil, translate("Zone name is too long") - else - return value - end -end - p = { s:taboption("general", ListValue, "input", translate("Input")), s:taboption("general", ListValue, "output", translate("Output")), |