Mercurial > libervia-website
annotate pages/documentation/page_meta.py @ 11:87262027cbf5
news: use pagination and search box as in Libervia Web's blog
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 23 Apr 2021 11:04:36 +0200 |
parents | f47d6ba74a26 |
children | 5fd933e238bb |
rev | line source |
---|---|
0 | 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 | |
6 | 9 name = "documentation" |
10 template = "doc/doc.html" | |
0 | 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: | |
9
f47d6ba74a26
pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents:
6
diff
changeset
|
23 allowed_docs.remove('backend') |
0 | 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 | 26 else: |
9
f47d6ba74a26
pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents:
6
diff
changeset
|
27 allowed_docs.insert(0, "backend") |
0 | 28 try: |
29 doc_name = self.nextPath(request) | |
30 except IndexError: | |
9
f47d6ba74a26
pages (documentation): update following renaming
Goffi <goffi@goffi.org>
parents:
6
diff
changeset
|
31 doc_name = 'backend' |
0 | 32 else: |
33 if doc_name not in allowed_docs: | |
6 | 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 | 36 template_data['doc_name'] = doc_name |
37 template_data['all_docs'] = allowed_docs |