Exemple #1
0
def get_static_page(key, language=None):
    backend = get_backend()
    if language is None:
        page = backend.get(key, i18n.all_languages(include_preferences=True))
    else:
        page = backend.get(key, [language])
    if page is not None:
        page.require_permission()
    return page
Exemple #2
0
 def staticpages_get(self, base=None, languages=None):
     if languages is None:
         languages = i18n.all_languages(include_preferences=True)
     params = OrderedDict({'lang': languages})
     if base is not None:
         params['base'] = base
     request = requests.Request("GET",
                                url='%s%s' % (
                                    self.staticpages_api_address,
                                    "staticpages",
                                ),
                                params=params,
                                headers=self.staticpages_headers)
     return self.session.send(request.prepare(),
                              verify=self.staticpages_verify)
Exemple #3
0
    def staticpage_get(self, path, languages=None):
        if languages is None:
            languages = i18n.all_languages(include_preferences=True)
        request = requests.Request("GET",
                                   url='%s%s' % (
                                       self.staticpages_api_address,
                                       'staticpages/single',
                                   ),
                                   params=OrderedDict({
                                       'path': path,
                                       'lang': languages,
                                   }),
                                   headers=self.staticpages_headers)

        return self.session.send(request.prepare(),
                                 verify=self.staticpages_verify)
Exemple #4
0
    def staticpage_get(self, path, languages=None):
        if languages is None:
            languages = i18n.all_languages(include_preferences=True)
        request = requests.Request("GET",
                                   url='%s%s' % (
                                       self.staticpages_api_address,
                                       'staticpages/single',
                                   ),
                                   params=OrderedDict({
                                       'path': path,
                                       'lang': languages,
                                   }),
                                   headers=self.staticpages_headers)

        return self.session.send(request.prepare(),
                                 verify=self.staticpages_verify)
Exemple #5
0
 def staticpages_get(self, base=None, languages=None):
     if languages is None:
         languages = i18n.all_languages(include_preferences=True)
     params = OrderedDict({
         'lang': languages
     })
     if base is not None:
         params['base'] = base
     request = requests.Request("GET",
                                url='%s%s' % (
                                    self.staticpages_api_address,
                                    "staticpages",
                                ),
                                params=params,
                                headers=self.staticpages_headers)
     return self.session.send(request.prepare(),
                              verify=self.staticpages_verify)
Exemple #6
0
class NewForm(EditForm):
    key = forms.StaticPageKey()
    lang = validators.OneOf(set(i18n.all_languages()))