view pages/documentation/page_meta.py @ 2:abef25655882

i18n: fixed typo in French
author Goffi <goffi@goffi.org>
date Tue, 28 May 2019 09:24:40 +0200
parents 09d66acc7c73
children 9ce41ef66dfa
line wrap: on
line source

#!/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