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
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)
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)
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)
class NewForm(EditForm): key = forms.StaticPageKey() lang = validators.OneOf(set(i18n.all_languages()))