annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python2.7
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
3
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
4 from sat.core.log import getLogger
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
5 from sat.core.i18n import _
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
6
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
7 log = getLogger(__name__)
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
8
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
9 name = u"documentation"
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
10 template = u"doc/doc.html"
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
11
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
12 allowed_docs = None
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
13
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
14
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
15 def parse_url(self, request):
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
16 """URL is /[DOC_NAME]"""
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
17 global allowed_docs
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
18 template_data = request.template_data
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
19
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
20 if allowed_docs is None:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
21 allowed_docs = sorted(self.getConfig("sub_docs_dict", {}).keys())
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 try:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
23 allowed_docs.remove(u'sat')
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 except KeyError:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
25 log.error(u"sat doc not available")
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 else:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
27 allowed_docs.insert(0, u"sat")
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 try:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
29 doc_name = self.nextPath(request)
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 except IndexError:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
31 doc_name = u'sat'
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
32 else:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
33 if doc_name not in allowed_docs:
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
34 log.warning(_(u"unknown doc name: {doc_name}").format(doc_name=doc_name))
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
35 doc_name = u'sat'
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
36 template_data[u'doc_name'] = doc_name
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
37 template_data[u'all_docs'] = allowed_docs