summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/template.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-30 19:12:16 +0000
committerSteven Barth <steven@midlink.org>2008-03-30 19:12:16 +0000
commit9b4e269bea4db2e75d3d33757a53d2ab89bf05bf (patch)
tree0e67237edc84967682aa67eaa9afb61630e56b29 /src/ffluci/template.lua
parenteee28047913d9bc159ebc49e72807db413ec73c7 (diff)
* Added reboot page
* Added SSH-Keys page * ffluci.template: Removed a debugging statement
Diffstat (limited to 'src/ffluci/template.lua')
-rw-r--r--src/ffluci/template.lua21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/ffluci/template.lua b/src/ffluci/template.lua
index 2bc0150812..52bebbcf4a 100644
--- a/src/ffluci/template.lua
+++ b/src/ffluci/template.lua
@@ -120,10 +120,6 @@ function compile(template)
template = string.dump(tf)
end
- c = c or 1
- ffluci.fs.writefile("/tmp/"..tostring(c), template)
- c = c+1
-
return template
end
@@ -179,9 +175,14 @@ function Template.__init__(self, name)
-- Build if there is no compiled file or if compiled file is outdated
if ((commt == nil) and not (tplmt == nil))
or (not (commt == nil) and not (tplmt == nil) and commt < tplmt) then
- local compiled = compile(ffluci.fs.readfile(sourcefile))
- ffluci.fs.writefile(compiledfile, compiled)
- self.template, err = loadstring(compiled)
+ local source
+ source, err = ffluci.fs.readfile(sourcefile)
+
+ if source then
+ local compiled = compile(source)
+ ffluci.fs.writefile(compiledfile, compiled)
+ self.template, err = loadstring(compiled)
+ end
else
self.template, err = loadfile(compiledfile)
end
@@ -190,7 +191,11 @@ function Template.__init__(self, name)
self.template, err = loadfile(self.compiledfile)
elseif compiler_mode == "memory" then
- self.template, err = loadstring(compile(ffluci.fs.readfile(sourcefile)))
+ local source
+ source, err = ffluci.fs.readfile(sourcefile)
+ if source then
+ self.template, err = loadstring(compile(source))
+ end
end