當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。