comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:09d66acc7c73
1 #!/usr/bin/env python2.7
2 # -*- coding: utf-8 -*-
3
4 from sat.core.log import getLogger
5 from sat.core.i18n import _
6
7 log = getLogger(__name__)
8
9 name = u"documentation"
10 template = u"doc/doc.html"
11
12 allowed_docs = None
13
14
15 def parse_url(self, request):
16 """URL is /[DOC_NAME]"""
17 global allowed_docs
18 template_data = request.template_data
19
20 if allowed_docs is None:
21 allowed_docs = sorted(self.getConfig("sub_docs_dict", {}).keys())
22 try:
23 allowed_docs.remove(u'sat')
24 except KeyError:
25 log.error(u"sat doc not available")
26 else:
27 allowed_docs.insert(0, u"sat")
28 try:
29 doc_name = self.nextPath(request)
30 except IndexError:
31 doc_name = u'sat'
32 else:
33 if doc_name not in allowed_docs:
34 log.warning(_(u"unknown doc name: {doc_name}").format(doc_name=doc_name))
35 doc_name = u'sat'
36 template_data[u'doc_name'] = doc_name
37 template_data[u'all_docs'] = allowed_docs