def preferences(request): api = TemplateAPI(request, _('Your preferences')) current_lang = locale_negotiator(request) settings = request.registry.settings available_langs = settings['lasco.available_languages'].split() current_theme = request.cookies.get('color_theme', 'default') return {'api': api, 'current_theme': current_theme, 'available_themes': AVAILABLE_THEMES, 'current_lang': current_lang, 'available_langs': available_langs}
def login_form(request, failed=False): api = TemplateAPI(request, 'Log in') next = request.GET.get('next') or \ request.POST.get('next') or \ quote_plus(api.referrer or api.app_url) login = request.POST.get('login', '') if failed: error_msg = _(u'Wrong user name or password.') else: error_msg = None return {'api': api, 'login': login, 'next': next, 'error_msg': error_msg}
def help(request): api = TemplateAPI(request, _('Help')) return {'api': api}
def not_found(request): api = TemplateAPI(request, _(u'Page not found')) api.show_login_link = False request.response.status = 404 return {'api': api, 'resource_url': request.url}