aboutsummaryrefslogtreecommitdiff
path: root/src/ContentManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ContentManager.cpp')
-rw-r--r--src/ContentManager.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ContentManager.cpp b/src/ContentManager.cpp
index 8bff717..a110e05 100644
--- a/src/ContentManager.cpp
+++ b/src/ContentManager.cpp
@@ -8,15 +8,14 @@ void ContentManager::SetTemplateSystem(std::shared_ptr<TemplateManager> const &
bool ContentManager::RegisterModule(std::shared_ptr<Content> ctnt)
{
std::string const & basePath = ctnt->GetUriBasePath();
- Redirections const & rs = ctnt->GetRedirections();
- m_ContentModules[basePath] = ctnt;
- for (auto & redirect : rs)
+ if (basePath.empty() == true)
{
- m_ContentModulesRoutes[redirect] = ctnt;
+ return false;
}
+ m_ContentModules[basePath] = ctnt;
- return false;
+ return true;
}
bool ContentManager::InitAll(void)
@@ -29,6 +28,12 @@ bool ContentManager::InitAll(void)
{
ret = false;
}
+
+ Redirections const & rs = content.second->GetRedirections();
+ for (auto & redirect : rs)
+ {
+ m_ContentModulesRoutes[redirect] = content.second;
+ }
}
return ret;
@@ -76,10 +81,10 @@ bool ContentManager::Render(char const * basePath, RequestResponse & rr, std::st
cntm = m_ContentModules[basePath];
}
- RenderData rd;
auto & main = cntm->GetMainTemplate();
out.clear();
+ RenderData rd;
if (cntm->Render(rr, rd, out) == false)
{
return false;