diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-08-17 21:43:56 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-08-17 21:43:56 +0000 |
commit | 5e606c8fe24a5d8be2b76b90bd03a6bee608a521 (patch) | |
tree | ef1dea3d28f0c123f5ec61fb7ea67a1562df64c6 | |
parent | 385c63d4fb5f890ebf23223c7e791f7ee5a9aec7 (diff) |
* luci/libs: uvl: rename validate() to validate_config() and reimplement validate() as "catch all" variant
-rw-r--r-- | libs/uvl/luasrc/uvl.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libs/uvl/luasrc/uvl.lua b/libs/uvl/luasrc/uvl.lua index 009077022..b3701b17e 100644 --- a/libs/uvl/luasrc/uvl.lua +++ b/libs/uvl/luasrc/uvl.lua @@ -75,11 +75,27 @@ function UVL.__init__( self, schemedir ) end +--- Validate given configuration, section or option. +-- @param config Name of the configuration to validate +-- @param section Name of the section to validate (optional) +-- @param option Name of the option to validate (optional) +-- @return Boolean indicating whether the given config validates +-- @return String containing the reason for errors (if any) +function UVL.validate( self, config, section, option ) + if config and section and option then + return self:validate_option( config, section, option ) + elseif config and section then + return self:validate_section( config, section ) + elseif config then + return self:validate_config( config ) + end +end + --- Validate given configuration. -- @param config Name of the configuration to validate -- @return Boolean indicating whether the given config validates -- @return String containing the reason for errors (if any) -function UVL.validate( self, config ) +function UVL.validate_config( self, config ) if not self.packages[config] then local ok, err = pcall( self.read_scheme, self, config ) |