• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tags.form函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nevow.tags.form函数的典型用法代码示例。如果您正苦于以下问题:Python form函数的具体用法?Python form怎么用?Python form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: render_forms

    def render_forms(self, ctx, data):
        forms = []

        if self.node.is_readonly():
            return T.div["No upload forms: directory is read-only"]
        if self.dirnode_children is None:
            return T.div["No upload forms: directory is unreadable"]

        mkdir = T.form(action=".", method="post",
                       enctype="multipart/form-data")[
            T.fieldset[
            T.input(type="hidden", name="t", value="mkdir"),
            T.input(type="hidden", name="when_done", value="."),
            T.legend(class_="freeform-form-label")["Create a new directory in this directory"],
            "New directory name: ",
            T.input(type="text", name="name"), " ",
            T.input(type="submit", value="Create"),
            ]]
        forms.append(T.div(class_="freeform-form")[mkdir])

        upload = T.form(action=".", method="post",
                        enctype="multipart/form-data")[
            T.fieldset[
            T.input(type="hidden", name="t", value="upload"),
            T.input(type="hidden", name="when_done", value="."),
            T.legend(class_="freeform-form-label")["Upload a file to this directory"],
            "Choose a file to upload: ",
            T.input(type="file", name="file", class_="freeform-input-file"),
            " ",
            T.input(type="submit", value="Upload"),
            " Mutable?:",
            T.input(type="checkbox", name="mutable"),
            ]]
        forms.append(T.div(class_="freeform-form")[upload])

        mount = T.form(action=".", method="post",
                        enctype="multipart/form-data")[
            T.fieldset[
            T.input(type="hidden", name="t", value="uri"),
            T.input(type="hidden", name="when_done", value="."),
            T.legend(class_="freeform-form-label")["Add a link to a file or directory which is already in Tahoe-LAFS."],
            "New child name: ",
            T.input(type="text", name="name"), " ",
            "URI of new child: ",
            T.input(type="text", name="uri"), " ",
            T.input(type="submit", value="Attach"),
            ]]
        forms.append(T.div(class_="freeform-form")[mount])
        return forms
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:49,代码来源:directory.py


示例2: render_exits

    def render_exits(self, ctx, data):
        if self.bse != 'Room':
            return ''

        xs = self.obj.exits()
        xs.sort(key=attrgetter('name'))
        if xs:
            lines = [T.h2(_class="section")['Exits:']]

            rows = []
            for x in xs:
                tzid = x.tzid
                destf = 'dest_%s' % tzid
                namef = 'name_%s' % tzid
                dest = x.destination
                rows.append(T.tr[
                                T.td[self.deletelink_widget(x)],
                                T.td[self.editlink_widget(x)],
                                T.td[self.str_widget(namef, x.name, 20)],
                                T.td['-->'],
                                T.td[self.rooms_widget(destf, dest)],
                                T.td[self.editlink_widget(dest)],
                                T.td[T.input(_type="submit", value="update")]])
            tbl = T.table(_class="center")[rows]
            lines.append(tbl)
            return T.form(action="/exits/update/", method="POST")[lines]

        else:
            return T.h2(_class="warn")['No exits']
开发者ID:cryptixman,项目名称:tzmud,代码行数:29,代码来源:pages_edit.py


示例3: render_controls

 def render_controls(self, ctx, data):
     request = inevow.IRequest(ctx)
     if request.args.get('shutdown'):
         return ""
     return tags.form(method="POST")[
         tags.input(type="submit", name="shutdown", value="Shut Down")
     ]
开发者ID:2mf,项目名称:pyicqt,代码行数:7,代码来源:handler.py


示例4: render_check_form

    def render_check_form(self, ctx, data):
        node = self.original
        quoted_uri = urllib.quote(node.get_uri())
        target = self.get_root(ctx) + "/uri/" + quoted_uri
        if IDirectoryNode.providedBy(node):
            target += "/"
        check = T.form(action=target, method="post",
                       enctype="multipart/form-data")[
            T.fieldset[
            T.input(type="hidden", name="t", value="check"),
            T.input(type="hidden", name="return_to", value="."),
            T.legend(class_="freeform-form-label")["Check on this object"],
            T.div[
            "Verify every bit? (EXPENSIVE):",
            T.input(type="checkbox", name="verify"),
            ],
            T.div["Repair any problems?: ",
                  T.input(type="checkbox", name="repair")],
            T.div["Add/renew lease on all shares?: ",
                  T.input(type="checkbox", name="add-lease")],
            T.div["Emit results in JSON format?: ",
                  T.input(type="checkbox", name="output", value="JSON")],

            T.input(type="submit", value="Check"),

            ]]
        return ctx.tag[check]
开发者ID:ArtRichards,项目名称:tahoe-lafs,代码行数:27,代码来源:info.py


示例5: calculateDefaultSkin

    def calculateDefaultSkin(self, context):
        if self.isGrouped:
            frm = tags.invisible
            butt = ""
            fld = tags.invisible
        else:
            frm = tags.form(
                id=slot("form-id"),
                name=slot("form-id"),
                action=slot("form-action"),
                method="post",
                enctype="multipart/form-data",
                **{"accept-charset": "utf-8"}
            )
            butt = slot("form-button")
            fld = tags.fieldset[tags.input(type="hidden", name="_charset_")]

        ## Provide default skin since no skin was provided for us.
        context.tag.clear()[
            frm[
                fld[
                    tags.legend(_class="freeform-form-label")[slot("form-label")],
                    tags.div(_class="freeform-form-description")[slot("form-description")],
                    tags.div(_class="freeform-form-error")[slot("form-error")],
                    slot("form-arguments"),
                    butt,
                ]
            ]
        ]
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:29,代码来源:webform.py


示例6: render_childDel

 def render_childDel(self, context, xxx_todo_changeme):
     (name, _) = xxx_todo_changeme
     ret = T.form(action="./freeform_post!!deleteChild",
                  enctype="multipart/form-data", method="POST")[
            T.input(type="hidden", name="name", value=name),
            T.input(type="submit", value="Delete")]
     return ret
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:7,代码来源:tree.py


示例7: __init__

        def __init__(self, ctx, restWriter, key, srcId):
            self.restWriter = restWriter

            form = iformal.IForm( ctx )
            u = formal_widgetResourceURLFromContext(ctx, form.name).child(key).child( srcId ).child('_submit')
            self.destId=srcId + '-dest'
            formId=srcId + '-form'

            stan = T.html()[
                T.head()[
                    T.script(type="text/javascript")["""
                    function ReSTTranslate() {
                        dest = document.getElementById('%(destId)s');
                        form = document.getElementById('%(formId)s');
                        src = parent.document.getElementById('%(srcId)s');
                        dest.value = src.value;
                        form.submit();
                    }

                    """%{'srcId':srcId, 'destId':self.destId, 'formId':formId}]
                ],
                T.body()[
                    T.form(id=formId, method="POST", action=u)[
                        T.input(type="hidden", name=self.destId, id=self.destId)
                    ],
                    T.script(type="text/javascript")["ReSTTranslate();"],
                ],
            ]

            self.docFactory = loaders.stan(stan)
开发者ID:timparkin,项目名称:into-the-light,代码行数:30,代码来源:richtext.py


示例8: render_upload_form

    def render_upload_form(self, ctx, data):
        # This is a form where users can upload unlinked files.
        # Users can choose immutable, SDMF, or MDMF from a radio button.

        upload_chk  = T.input(type='radio', name='format',
                              value='chk', id='upload-chk',
                              checked='checked')
        upload_sdmf = T.input(type='radio', name='format',
                              value='sdmf', id='upload-sdmf')
        upload_mdmf = T.input(type='radio', name='format',
                              value='mdmf', id='upload-mdmf')

        form = T.form(action="uri", method="post",
                      enctype="multipart/form-data")[
            T.fieldset[
            T.legend(class_="freeform-form-label")["Upload a file"],
            T.div["Choose a file:"+SPACE,
                  T.input(type="file", name="file", class_="freeform-input-file")],
            T.input(type="hidden", name="t", value="upload"),
            T.div[upload_chk,  T.label(for_="upload-chk") [" Immutable"],           SPACE,
                  upload_sdmf, T.label(for_="upload-sdmf")[" SDMF"],                SPACE,
                  upload_mdmf, T.label(for_="upload-mdmf")[" MDMF (experimental)"], SPACE*2,
                  T.input(type="submit", value="Upload!")],
            ]]
        return T.div[form]
开发者ID:warner,项目名称:tahoe-lafs,代码行数:25,代码来源:root.py


示例9: rend

    def rend(self, context, data):
        context.remember(data, iformless.IBinding)

        from formless import configurable as conf

        configurable = conf.GroupConfigurable(data.boundTo, data.typedValue.iface)
        context.remember(configurable, iformless.IConfigurable)

        bindingNames = configurable.getBindingNames(context)

        def generateBindings():
            for name in bindingNames:
                bnd = configurable.getBinding(context, name)
                renderer = iformless.IBindingRenderer(bnd, defaultBindingRenderer)
                renderer.isGrouped = True
                renderer.needsSkin = True
                yield tags.invisible(
                    data=bnd,
                    render=renderer,
                    key=name)

        return getError(context), tags.form(
            id=keyToXMLID(context.key),
            enctype="multipart/form-data",
            action=calculatePostURL(context, data),
            method="post",
            **{'accept-charset':'utf-8'})[
                tags.fieldset[
                    tags.legend(_class="freeform-form-label")[data.label],
                    tags.input(type='hidden', name='_charset_'),
                    generateBindings(),
                    tags.input(type="submit")]]
开发者ID:StetHD,项目名称:nevow,代码行数:32,代码来源:webform.py


示例10: render_settings

    def render_settings(self, ctx, data):
        settings = self.obj.settings[:]
        if self.bse != 'Room':
            settings.append('room')
        if self.bse == 'Exit':
            settings.append('destination')

        lines = []
        for setting in settings:
            error = self.args.get('_%s__error' % setting, False)
            if error:
                cls = 'textlabel_error'
            else:
                cls = 'textlabel'
            label = T.td(_class=cls)[setting]
            val = self.obj.setting(setting)
            if val is None:
                val = getattr(self.obj, setting, None)
            inpt = T.td[self.get_setting_widget(setting, val)]
            lines.append(T.tr[label, inpt])

        if self.bse != 'Room' and self.obj.container != self.obj.room:
            label = T.td(_class="textlabel")['container']
            inpt = T.td[self.container_widget(self.obj)]
            lines.append(T.tr[label, inpt])

        empty = T.td(_class='empty')['']
        lines.append(T.tr[empty, empty])
        submit = T.input(_type="submit", value=" Change ")
        lines.append(T.tr[empty, T.td[submit]])

        tbl = T.table(_class="center")[lines]

        return T.form(action=".", method="POST")[tbl]
开发者ID:cryptixman,项目名称:tzmud,代码行数:34,代码来源:pages_edit.py


示例11: render_deep_stats_form

 def render_deep_stats_form(self, ctx, data):
     ophandle = base32.b2a(os.urandom(16))
     deep_stats = T.form(action=".", method="post",
                         enctype="multipart/form-data")[
         T.fieldset[
         T.input(type="hidden", name="t", value="start-deep-stats"),
         T.legend(class_="freeform-form-label")["Run a deep-stats operation (EXPENSIVE)"],
         T.input(type="hidden", name="ophandle", value=ophandle),
         T.input(type="submit", value="Deep-Stats"),
         ]]
     return ctx.tag[deep_stats]
开发者ID:ArtRichards,项目名称:tahoe-lafs,代码行数:11,代码来源:info.py


示例12: render_forms

 def render_forms(self, ctx, data):
     f = T.form(action=".", method="get")
     table = []
     for (name,default_value,argtype,description) in self.DEFAULT_PARAMETERS:
         old_value = self.parameters[name]
         i = self.make_input(name, old_value)
         table.append(T.tr[T.td[name+":"], T.td[i], T.td[description]])
     go = T.input(type="submit", value="Recompute")
     return [T.h2["Simulation Parameters:"],
             f[T.table[table], go],
             ]
开发者ID:GunioRobot,项目名称:tahoe-lafs,代码行数:11,代码来源:reliability.py


示例13: render_incident_button

 def render_incident_button(self, ctx, data):
     # this button triggers a foolscap-logging "incident"
     form = T.form(action="report_incident", method="post",
                   enctype="multipart/form-data")[
         T.fieldset[
         T.input(type="hidden", name="t", value="report-incident"),
         "What went wrong?"+SPACE,
         T.input(type="text", name="details"), SPACE,
         T.input(type="submit", value=u"Save \u00BB"),
         ]]
     return T.div[form]
开发者ID:warner,项目名称:tahoe-lafs,代码行数:11,代码来源:root.py


示例14: render_mkdir_form

 def render_mkdir_form(self, ctx, data):
     # this is a form where users can create new directories
     form = T.form(action="uri", method="post",
                   enctype="multipart/form-data")[
         T.fieldset[
         T.legend(class_="freeform-form-label")["Create a directory"],
         T.input(type="hidden", name="t", value="mkdir"),
         T.input(type="hidden", name="redirect_to_result", value="true"),
         T.input(type="submit", value="Create a directory"),
         ]]
     return T.div[form]
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:11,代码来源:root.py


示例15: render_view_form

 def render_view_form(self, ctx, data):
     # this is a form where users can download files by URI, or jump to a
     # named directory
     form = T.form(action="uri", method="get",
                   enctype="multipart/form-data")[
         T.fieldset[
         T.legend(class_="freeform-form-label")["View a file or directory"],
         "Tahoe-URI to view: ",
         T.input(type="text", name="uri"), " ",
         T.input(type="submit", value="View!"),
         ]]
     return T.div[form]
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:12,代码来源:root.py


示例16: render_incident_button

 def render_incident_button(self, ctx, data):
     # this button triggers a foolscap-logging "incident"
     form = T.form(action="report_incident", method="post",
                   enctype="multipart/form-data")[
         T.fieldset[
         T.legend(class_="freeform-form-label")["Report an Incident"],
         T.input(type="hidden", name="t", value="report-incident"),
         "What went wrong?: ",
         T.input(type="text", name="details"), " ",
         T.input(type="submit", value="Report!"),
         ]]
     return T.div[form]
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:12,代码来源:root.py


示例17: getWidgetDocument

 def getWidgetDocument(self):
     # XXX No support for rendering these yet!
     f = liveform.LiveForm(
         self.submit,
         [liveform.Parameter('argument', None, unicode)])
     f.docFactory = loaders.stan(tags.form(render=tags.directive('liveElement'))[
         tags.select(name="argument")[
             tags.option(value="apples")["apples"],
             tags.option(value="oranges")["oranges"]],
         tags.input(type='submit', render=tags.directive('submitbutton'))])
     f.setFragmentParent(self)
     return f
开发者ID:fusionapp,项目名称:mantissa,代码行数:12,代码来源:livetest_forms.py


示例18: createWorldPayForm

def createWorldPayForm(ctx, config, purchaseId, basketHash, totalPrice, description,
        cardholder, withDelivery=False, fixContact=False):

    def maxLength(src, length):
        return src[:length]

    # Check the purchase ID is not too long
    purchaseId = str(purchaseId)
    if purchaseId != maxLength(purchaseId, 255):
        raise Exception("purchaseId must be less than 255 characters")

    # Decode the test mode.
    testMode = config['testMode']
    if testMode is not None:
        if testMode.lower() == 'succeed':
            testMode = ALWAYS_SUCCEED
        else:
            testMode = ALWAYS_FAIL

    # Decide what callback URL to use, if any.
    callback = callbackURL(ctx, config.get('callback'))

    rv = T.form(action=config['url'], method="post")
    # Worldpay account access
    rv[T.input(type="hidden", name="instId", value=config["instid"])]
    if testMode is not None:
        rv[T.input(type="hidden", name="testMode", value=testMode)]
    # General basket stuff
    rv[T.input(type="hidden", name="cartId", value=purchaseId)]
    rv[T.input(type="hidden", name="amount", value="%0.2f"%totalPrice)]
    rv[T.input(type="hidden", name="currency", value="GBP")]
    rv[T.input(type="hidden", name="desc", value=description)]
    # Basket hash
    rv[T.input(type="hidden", name="M_hash", value=basketHash)]
    # Buyer's details
    rv[T.input(type="hidden", name="name", value=maxLength(cardholder.name, 40))]
    rv[T.input(type="hidden", name="address", value=maxLength(cardholder.address, 255))]
    rv[T.input(type="hidden", name="postcode", value=maxLength(cardholder.postcode, 12))]
    rv[T.input(type="hidden", name="country", value=cardholder.country)]
    rv[T.input(type="hidden", name="email", value=maxLength(cardholder.email,80))]
    # Enable entry of the delivery address
    if withDelivery:
        rv[T.input(type="hidden", name="withDelivery")]
    # The cardholder and delivery details can optionally be fixed.
    if fixContact:
        rv[T.input(type="hidden", name="fixContact")]
    # Callback override
    if callback is not None:
        rv[T.input(type="hidden", name="MC_callback", value=callback)]
    # A button to post the form to Worldpay
    rv[T.input(type="submit", value="Enter Payment Details")]

    return rv
开发者ID:timparkin,项目名称:into-the-light,代码行数:53,代码来源:worldpay.py


示例19: render_download_form

 def render_download_form(self, ctx, data):
     # this is a form where users can download files by URI
     form = T.form(action="uri", method="get",
                   enctype="multipart/form-data")[
         T.fieldset[
         T.legend(class_="freeform-form-label")["Download a file"],
         T.div["Tahoe-URI to download: ",
               T.input(type="text", name="uri")],
         T.div["Filename to download as: ",
               T.input(type="text", name="filename")],
         T.input(type="submit", value="Download!"),
         ]]
     return T.div[form]
开发者ID:drewp,项目名称:tahoe-lafs,代码行数:13,代码来源:root.py


示例20: render_repair

 def render_repair(self, ctx, data):
     if data.is_healthy():
         return ""
     repair = T.form(action=".", method="post",
                     enctype="multipart/form-data")[
         T.fieldset[
         T.input(type="hidden", name="t", value="check"),
         T.input(type="hidden", name="repair", value="true"),
         T.input(type="submit", value="Repair"),
         ]]
     return "" # repair button disabled until we make it work correctly,
               # see #622 for details
     return ctx.tag[repair]
开发者ID:LeastAuthority,项目名称:tahoe-lafs,代码行数:13,代码来源:check_results.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tags.html函数代码示例发布时间:2022-05-27
下一篇:
Python tags.div函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap