summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorNathan Angelacos <nangel@tetrasec.net>2007-11-02 21:01:45 +0000
committerNathan Angelacos <nangel@tetrasec.net>2007-11-02 21:01:45 +0000
commitee27a6341f094e239837c7077e86b0c7f0c306bc (patch)
treea628d69ea056990baf3bb5a2bcfadcb0aa27ae3b /app
parentd49ec1941b5621f47662c422c0557d62385583bd (diff)
downloadacf-core-ee27a6341f094e239837c7077e86b0c7f0c306bc.tar.bz2
acf-core-ee27a6341f094e239837c7077e86b0c7f0c306bc.tar.xz
mvc.lua - change new to return 3 values, new mvc object,
and a boolean each for the status of loading the named controller and model acf_www-controller.lua - example showing how to cope if the mvc:new returns with a missing model/controller git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@266 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app')
-rw-r--r--app/acf_www-controller.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua
index 742533a..4f5b755 100644
--- a/app/acf_www-controller.lua
+++ b/app/acf_www-controller.lua
@@ -119,12 +119,24 @@ view_resolver = function(self)
-- with conf, and other "missing" parts pointing back
-- to APP or self
-- ***************************************************
- local m = self:new("alpine-baselayout/hostname")
- local h = m.worker.read(m)
+ local m,worker_loaded,model_loaded = self:new("alpine-baselayout/hostname")
+
+ -- FIXME - this is ugly, but it puts the hostname the expected
+ -- format if the controller doesn't load correctly
+ local h = {}
+
+ -- If the worker and model loaded correctly, then
+ -- use the sub-controller
+ if worker_loaded && model_loaded then
+ h = m.worker.read(m)
+ else
+ h.hostname = { value = "unknown" }
+ end
local pageinfo = { viewfile = viewname,
controller = m.conf.controller,
-- ^^^ see.. m.conf doesnt exist - but it works
+ -- the inheritance means self.conf is used instead
action = self.conf.action,
hostname = h.hostname.value,
prefix = self.conf.prefix,