libs/web: fix "port" datatype to allow port 0
[oweals/luci.git] / libs / web / luasrc / template.lua
index 90ac69fbac933d22cf354704f5e1df1a6588f6e7..80a3206af59b0c1dc15b0e0df1bbf10844b7dc64 100644 (file)
@@ -24,13 +24,8 @@ limitations under the License.
 
 ]]--
 
-local fs = require "nixio.fs"
-local sys = require "luci.sys"
 local util = require "luci.util"
-local table = require "table"
-local string = require "string"
 local config = require "luci.config"
-local nixio = require "nixio", require "nixio.util"
 local tparser = require "luci.template.parser"
 
 local tostring, pairs, loadstring = tostring, pairs, loadstring
@@ -76,7 +71,9 @@ function Template.__init__(self, name)
        if not self.template then
 
                -- Compile template
+               local err
                local sourcefile = viewdir .. "/" .. name .. ".htm"
+
                self.template, _, err = tparser.parse(sourcefile)
 
                -- If we have no valid template throw error, otherwise cache the template