当前位置: 首页>>代码示例>>Python>>正文


Python Form.checkbox方法代码示例

本文整理汇总了Python中forms.Form.checkbox方法的典型用法代码示例。如果您正苦于以下问题:Python Form.checkbox方法的具体用法?Python Form.checkbox怎么用?Python Form.checkbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forms.Form的用法示例。


在下文中一共展示了Form.checkbox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from forms import Form [as 别名]
# 或者: from forms.Form import checkbox [as 别名]
    def main(self, message='', **kwargs):
        store = filedict_con(cfg.store_file, 'sys')

        defaults = {'wan_admin': "''",
                    'wan_ssh': "''",
                    'lan_ssh': "''",
                    }
        for k,c in defaults.items():
            if not k in kwargs:
                try:
                    kwargs[k] = store[k]
                except KeyError:
                    exec("if not '%(k)s' in kwargs: store['%(k)s'] = kwargs['%(k)s'] = %(c)s" % {'k':k, 'c':c})

        form = Form(title=_("Accessing the %s" % cfg.box_name), 
                        action="/sys/config/wan", 
                        name="admin_wan_form",
                        message=message )
        form.html(self.help())
        if cfg.users.expert():
            form.checkbox(_("Allow access to Plinth from WAN"), name="wan_admin", checked=kwargs['wan_admin'])
            form.checkbox(_("Allow SSH access from LAN"), name="lan_ssh", checked=kwargs['lan_ssh'])
            form.checkbox(_("Allow SSH access from WAN"), name="wan_ssh", checked=kwargs['wan_ssh'])
        form.submit(_("Submit"))
        return form.render()
开发者ID:Keith2,项目名称:Plinth,代码行数:27,代码来源:wan.py

示例2: main

# 需要导入模块: from forms import Form [as 别名]
# 或者: from forms.Form import checkbox [as 别名]
 def main(self, expert=None, message='', **kwargs):
     """Note that kwargs contains '':"submit" if this is coming
     from a submitted form.  If kwargs is empty, it's a fresh form
     with no user input, which means it should just reflect the
     state of the stored data."""
     if not kwargs and expert == None:
         expert = cfg.users.expert()
         cfg.log("Expert mode is %s" % expert)
     form = Form(title=_("Expert Mode"), 
                     action="/sys/config/experts", 
                     name="expert_mode_form",
                     message=message )
     form.html(self.help())
     form.checkbox(_("Expert Mode"), name="expert", checked=expert)
     form.submit(_("Submit"))
     return form.render()
开发者ID:copyninja,项目名称:Plinth,代码行数:18,代码来源:expert_mode.py

示例3: main

# 需要导入模块: from forms import Form [as 别名]
# 或者: from forms.Form import checkbox [as 别名]
    def main(self, xmpp_inband_enable=False, message=None, *args, **kwargs):
        output, error = actions.superuser_run("xmpp-setup", 'status')
        if error:
            raise Exception("something is wrong: " + error)
        if "inband_enable" in output.split():
            xmpp_inband_enable = True

        form = Form(title="Configure XMPP Server",
                    action=cfg.server_dir + "/services/xmpp/configure/index",
                    name="configure_xmpp_form",
                    message=message)
        form.checkbox(_("Allow In-Band Registration"), name="xmpp_inband_enable",
                        id="xmpp_inband_enable", checked=xmpp_inband_enable)
        # hidden field is needed because checkbox doesn't post if not checked
        form.hidden(name="submitted", value="True")
        form.html(_("<p>When enabled, anyone who can reach this server will be allowed to register an account through an XMPP client.</p>"))
        form.submit(_("Update setup"))
        return form.render()
开发者ID:NickDaly,项目名称:plinth-debian-package,代码行数:20,代码来源:xmpp.py


注:本文中的forms.Form.checkbox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。