annotate pages/documentation/page_meta.py @ 32:c8916c5c142d

roadmap: delay…
author Goffi <goffi@goffi.org>
date Mon, 11 Dec 2023 01:12:15 +0100
parents e7c7327f9f25
children
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
28
e7c7327f9f25 refactoring: fix imports and names in doc following modules hierarchy refactoring
Goffi <goffi@goffi.org>
parents: 22
diff changeset
4 from libervia.backend.core.log import getLogger
e7c7327f9f25 refactoring: fix imports and names in doc following modules hierarchy refactoring
Goffi <goffi@goffi.org>
parents: 22
diff changeset
5 from libervia.backend.core.i18n import _
0
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
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
9 name = "documentation"
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
10 template = "doc/doc.html"
0
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:
22
5fd933e238bb massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 9
diff changeset
21 allowed_docs = sorted(self.config_get("sub_docs_dict", {}).keys())
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
22 try:
9
f47d6ba74a26 pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents: 6
diff changeset
23 allowed_docs.remove('backend')
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
24 except KeyError:
9
f47d6ba74a26 pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents: 6
diff changeset
25 log.error("backend doc not available")
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
26 else:
9
f47d6ba74a26 pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents: 6
diff changeset
27 allowed_docs.insert(0, "backend")
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
28 try:
22
5fd933e238bb massive refactoring from camelCase -> snake_case. See backend commit log for more details
Goffi <goffi@goffi.org>
parents: 9
diff changeset
29 doc_name = self.next_path(request)
0
09d66acc7c73 initial commit, website first draft:
Goffi <goffi@goffi.org>
parents:
diff changeset
30 except IndexError:
9
f47d6ba74a26 pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents: 6
diff changeset
31 doc_name = 'backend'
0
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:
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
34 log.warning(_("unknown doc name: {doc_name}").format(doc_name=doc_name))
9
f47d6ba74a26 pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents: 6
diff changeset
35 doc_name = 'backend'
6
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
36 template_data['doc_name'] = doc_name
9ce41ef66dfa python 3 port
Goffi <goffi@goffi.org>
parents: 0
diff changeset
37 template_data['all_docs'] = allowed_docs