diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-09-04 00:56:13 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-09-04 00:56:13 +0000 |
commit | 19e22598fd5b43a4e3e23e5e0d5f994281024035 (patch) | |
tree | c1aa83ca892d1380d2273f29bda950e865e804ef /libs/uvl/luasrc | |
parent | 34ab619ee3dd9fd04a4198288540e3a7a19aadf6 (diff) |
* luci/libs/uvl:
- implement aliasing in luci.uvl.read_scheme()
- fixed wrong enum definition in reference scheme
- fixed boolean() datatype validator to actually accept "true" and "false" literals
- extend uvl cli to validate schemes against the reference scheme (incomplete)
Diffstat (limited to 'libs/uvl/luasrc')
-rw-r--r-- | libs/uvl/luasrc/uvl.lua | 7 | ||||
-rw-r--r-- | libs/uvl/luasrc/uvl/datatypes.lua | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua index b1d481062..680581d22 100644 --- a/libs/uvl/luasrc/uvl.lua +++ b/libs/uvl/luasrc/uvl.lua @@ -351,7 +351,8 @@ end -- This is normally done on demand, so you don't have to call this function -- by yourself. -- @param scheme Name of the scheme to parse -function UVL.read_scheme( self, scheme ) +-- @param alias Create an alias for the loaded scheme +function UVL.read_scheme( self, scheme, alias ) local so = luci.uvl.scheme( self, scheme ) @@ -375,7 +376,9 @@ function UVL.read_scheme( self, scheme ) table.insert( schemes, sd ) end - return self:_read_scheme_parts( so, schemes ) + local ok, err = self:_read_scheme_parts( so, schemes ) + if ok and alias then self.packages[alias] = self.packages[scheme] end + return ok, err else return false, so:error(ERR.SME_FIND(so, self.schemedir)) end diff --git a/libs/uvl/luasrc/uvl/datatypes.lua b/libs/uvl/luasrc/uvl/datatypes.lua index ce18d47ed..60377e289 100644 --- a/libs/uvl/luasrc/uvl/datatypes.lua +++ b/libs/uvl/luasrc/uvl/datatypes.lua @@ -22,9 +22,9 @@ require("luci.util") function boolean( val ) - if val == "1" or val == "yes" or val == "on" then + if val == "1" or val == "yes" or val == "on" or val == "true" then return true - elseif val == "0" or val == "no" or val == "off" then + elseif val == "0" or val == "no" or val == "off" or val == "false" then return true end |