diff pages/documentation/page_meta.py @ 0:09d66acc7c73

initial commit, website first draft: - presentation page - documentation (generated from backend and Libervia) - social contract (HTML generated from sat repository) - press/conferences (adapted from former website) - association page (adpated from former website) - news (a selected blog is displayed) - fr i18n
author Goffi <goffi@goffi.org>
date Sun, 26 May 2019 22:26:30 +0200
parents
children 9ce41ef66dfa
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pages/documentation/page_meta.py	Sun May 26 22:26:30 2019 +0200
@@ -0,0 +1,37 @@
+#!/usr/bin/env python2.7
+# -*- coding: utf-8 -*-
+
+from sat.core.log import getLogger
+from sat.core.i18n import _
+
+log = getLogger(__name__)
+
+name = u"documentation"
+template = u"doc/doc.html"
+
+allowed_docs = None
+
+
+def parse_url(self, request):
+    """URL is /[DOC_NAME]"""
+    global allowed_docs
+    template_data = request.template_data
+
+    if allowed_docs is None:
+        allowed_docs = sorted(self.getConfig("sub_docs_dict", {}).keys())
+        try:
+            allowed_docs.remove(u'sat')
+        except KeyError:
+            log.error(u"sat doc not available")
+        else:
+            allowed_docs.insert(0, u"sat")
+    try:
+        doc_name = self.nextPath(request)
+    except IndexError:
+        doc_name = u'sat'
+    else:
+        if doc_name not in allowed_docs:
+            log.warning(_(u"unknown doc name: {doc_name}").format(doc_name=doc_name))
+            doc_name = u'sat'
+    template_data[u'doc_name'] = doc_name
+    template_data[u'all_docs'] = allowed_docs