コード例 #1
0
ファイル: options.py プロジェクト: ondratu/morias
def admin_options(req):
    check_login(req)
    check_right(req, module_right)

    section = req.args.getfirst('section', '', uni)
    module = req.args.getfirst('module', '', uni)
    kwargs = {}
    if section != 'all':
        kwargs['section'] = section
    if module != 'all':
        kwargs['module'] = module

    pager = Pager()
    pager.bind(req.args)
    options = Option.list(req, pager, **kwargs)
    for option in options:
        option.defaults_json = json.dumps(list(option.defaults))

    return generate_page(req, "admin/options.html", pager=pager,
                         options=options, sections=Option.sections_list(req),
                         modules=Option.modules_list(req), section=section,
                         module=module)