libs/cbi: don't run apply on render, this is a quick hack and will be reworked soon

This commit is contained in:
Jo-Philipp Wich 2010-10-11 22:55:49 +00:00
parent 2c22ea7b77
commit f735ef30bd

View file

@ -165,7 +165,7 @@ end
function Node._run_hook(self, hook) function Node._run_hook(self, hook)
if type(self[hook]) == "function" then if type(self[hook]) == "function" then
return self[hook](self) return self[hook](self)
end end
end end
function Node._run_hooks(self, ...) function Node._run_hooks(self, ...)
@ -356,7 +356,7 @@ end
function Map.render(self, ...) function Map.render(self, ...)
self:_run_hooks("on_init") self:_run_hooks("on_init")
Node.render(self, ...) Node.render(self, ...)
if self._apply then if false and self._apply then
local fp = self._apply() local fp = self._apply()
fp:read("*a") fp:read("*a")
fp:close() fp:close()
@ -514,7 +514,7 @@ function Delegator.parse(self, ...)
return FORM_DONE return FORM_DONE
end end
end end
if not Map.formvalue(self, "cbi.delg.current") then if not Map.formvalue(self, "cbi.delg.current") then
self:_run_hooks("on_init") self:_run_hooks("on_init")
end end
@ -524,11 +524,11 @@ function Delegator.parse(self, ...)
self.current = self.current or self:get_active() self.current = self.current or self:get_active()
self.active = self.active or self:get(self.current) self.active = self.active or self:get(self.current)
assert(self.active, "Invalid state") assert(self.active, "Invalid state")
local stat = FORM_DONE local stat = FORM_DONE
if type(self.active) ~= "function" then if type(self.active) ~= "function" then
self.active:populate_delegator(self) self.active:populate_delegator(self)
stat = self.active:parse() stat = self.active:parse()
else else
self:active() self:active()
end end
@ -542,11 +542,11 @@ function Delegator.parse(self, ...)
elseif stat < FORM_PROCEED then elseif stat < FORM_PROCEED then
return stat return stat
end end
if not Map.formvalue(self, "cbi.submit") then if not Map.formvalue(self, "cbi.submit") then
return FORM_NODATA return FORM_NODATA
elseif stat > FORM_PROCEED elseif stat > FORM_PROCEED
and (not newcurrent or not self:get(newcurrent)) then and (not newcurrent or not self:get(newcurrent)) then
return self:_run_hook("on_done") or FORM_DONE return self:_run_hook("on_done") or FORM_DONE
else else
@ -1264,7 +1264,7 @@ function AbstractValue.parse(self, section, novld)
table.insert(self.section.error[section], "invalid") table.insert(self.section.error[section], "invalid")
else else
self.section.error = {[section] = {"invalid"}} self.section.error = {[section] = {"invalid"}}
end end
self.map.save = false self.map.save = false
end end
if fvalue and not (fvalue == cvalue) then if fvalue and not (fvalue == cvalue) then