コード例 #1
0
ファイル: webform.py プロジェクト: StetHD/nevow
    def rend(self, context, data):
        defaults = context.locate(iformless.IFormDefaults)
        value = defaults.getDefault(context.key, context)
        context.remember(data.typedValue, iformless.ITyped)

        if data.typedValue.getAttribute('immutable'):
            inp = tags.span(id=keyToXMLID(context.key))[value]
        else:
            ##value may be a deferred; make sure to wait on it properly before calling self.input
            ## TODO: If flattening this results in an empty string, return an empty string
            inp = tags.invisible(
                render=lambda c, value: self.input( context, tags.invisible(), data, data.name, value ),
                data=value)

        if data.typedValue.getAttribute('hidden') or data.typedValue.getAttribute('compact'):
            return inp

        context.fillSlots( 'label', data.label )
        context.fillSlots( 'name', data.name )
        context.fillSlots( 'input', inp )
        context.fillSlots( 'error', getError(context) )
        context.fillSlots( 'description', data.description )
        context.fillSlots( 'id', keyToXMLID(context.key) )
        context.fillSlots( 'value', value )

        return context.tag
コード例 #2
0
ファイル: webform.py プロジェクト: StetHD/nevow
    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")]]
コード例 #3
0
    def rend(self, context, data):
        defaults = context.locate(iformless.IFormDefaults)
        value = defaults.getDefault(context.key, context)
        context.remember(data.typedValue, iformless.ITyped)

        if data.typedValue.getAttribute('immutable'):
            inp = span(id=keyToXMLID(context.key))[value]
        else:
            ##value may be a deferred; make sure to wait on it properly before calling self.input
            ## TODO: If flattening this results in an empty string, return an empty string
            inp = invisible(render=lambda c, value: self.input(
                context, invisible(), data, data.name, value),
                            data=value)

        if data.typedValue.getAttribute(
                'hidden') or data.typedValue.getAttribute('compact'):
            return inp

        context.fillSlots('label', data.label)
        context.fillSlots('name', data.name)
        context.fillSlots('input', inp)
        context.fillSlots('error', getError(context))
        context.fillSlots('description', data.description)
        context.fillSlots('id', keyToXMLID(context.key))
        context.fillSlots('value', value)

        return context.tag
コード例 #4
0
    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 invisible(data=bnd, render=renderer, key=name)

        return getError(context), form(
            id=keyToXMLID(context.key),
            enctype="multipart/form-data",
            action=calculatePostURL(context, data),
            method="post",
            **{'accept-charset': 'utf-8'
               })[fieldset[legend(_class="freeform-form-label")[data.label],
                           input(type='hidden', name='_charset_'),
                           generateBindings(),
                           input(type="submit")]]
コード例 #5
0
 def rend(self, context, data):
     defaults = context.locate(iformless.IFormDefaults)
     value = defaults.getDefault(context.key, context)
     context.remember(data.typedValue, iformless.ITyped)
     if data.typedValue.getAttribute('immutable'):
         inp = span(id=keyToXMLID(context.key))[value]
     else:
         inp = invisible(
             render=lambda c, value: self.input( context, invisible(), data, data.name, value ),
             data=value)
     if data.typedValue.getAttribute('hidden') or data.typedValue.getAttribute('compact'):
         return inp
     context.fillSlots( 'label', data.label )
     context.fillSlots( 'name', data.name )
     context.fillSlots( 'input', inp )
     context.fillSlots( 'error', getError(context) )
     context.fillSlots( 'description', data.description )
     context.fillSlots( 'id', keyToXMLID(context.key) )
     context.fillSlots( 'value', value )
     return context.tag
コード例 #6
0
ファイル: webform.py プロジェクト: StetHD/nevow
 def fillForm(self, context, data):
     context.fillSlots( 'form-id', keyToXMLID(context.key) )
     context.fillSlots( 'form-action', calculatePostURL(context, data) )
     context.fillSlots( 'form-name', data.name )
     context.fillSlots( 'form-error', getError(context) )
コード例 #7
0
 def fillForm(self, context, data):
     context.fillSlots('form-id', keyToXMLID(context.key))
     context.fillSlots('form-action', calculatePostURL(context, data))
     context.fillSlots('form-name', data.name)
     context.fillSlots('form-error', getError(context))
コード例 #8
0
ファイル: webform.py プロジェクト: perkinslr/nevow-py3
 def fillForm(self, context, data):
     context.fillSlots("form-id", keyToXMLID(context.key))
     context.fillSlots("form-action", calculatePostURL(context, data))
     context.fillSlots("form-name", data.name)
     context.fillSlots("form-error", getError(context))