def render_forms(self, ctx, data): d = iformless.IFormDefaults(ctx).getAllDefaults('insert') d['author'] = self.original.author d['category'] = self.original.category d['title'] = self.original.title d['content'] = self.original.content d['id'] = self.original.id return webform.renderForms()
def beforeRender(self, ctx): formDefs = iformless.IFormDefaults(ctx).getAllDefaults('updateWiki') content = IWikiContent(ctx) formDefs['new'] = "0" if content: formDefs['text'] = stan.xml(content) else: formDefs['new'] = "1"
def _innerFormRenderIt(context, data): tag = context.tag # Remember the key for when the form post URL is generated. context.remember(configurableKey, iformless.IConfigurableKey) if configurable is None: warnings.warn( "No configurable was found which provides enough type information for freeform to be able to render forms; %r" % (cf, )) yield '' return context.remember(configurable, iformless.IConfigurable) formDefaults = iformless.IFormDefaults(context) available = configurable.getBindingNames(context) bindings = [] default_binding_pattern = None for name in available: if bindingDefaults is not None: if name not in bindingDefaults: continue defs = formDefaults.getAllDefaults(name) defs.update(bindingDefaults[name]) bnd = configurable.getBinding(context, name) renderer = iformless.IBindingRenderer(bnd, defaultBindingRenderer, persist=False) try: binding_pattern = tag.patternGenerator( 'freeform-form!!%s' % name) except NodeNotFound: if default_binding_pattern is None: try: default_binding_pattern = tag.patternGenerator( 'freeform-form') except NodeNotFound: default_binding_pattern = freeformDefaultForm binding_pattern = default_binding_pattern if binding_pattern is freeformDefaultForm: renderer.needsSkin = True yield binding_pattern(data=bnd, render=renderer, key=name)
def _innerFormRenderIt(context, data): tag = context.tag # Remember the key for when the form post URL is generated. context.remember(configurableKey, iformless.IConfigurableKey) if configurable is None: warnings.warn( "No configurable was found which provides enough type information for freeform to be able to render forms" ) yield '' return context.remember(configurable, iformless.IConfigurable) formDefaults = iformless.IFormDefaults(context) if bindingDefaults is None: available = configurable.getBindingNames(context) else: available = bindingDefaults.iterkeys() def _callback(binding): renderer = iformless.IBindingRenderer(binding, defaultBindingRenderer) try: binding_pattern = tag.patternGenerator( 'freeform-form!!%s' % name) except NodeNotFound: try: binding_pattern = tag.patternGenerator('freeform-form') except NodeNotFound: binding_pattern = freeformDefaultForm if binding_pattern is freeformDefaultForm: renderer.needsSkin = True return binding_pattern(data=binding, render=renderer, key=name) for name in available: if bindingDefaults is not None: defs = formDefaults.getAllDefaults(name) defs.update(bindingDefaults[name]) d = util.maybeDeferred(configurable.getBinding, context, name) d.addCallback(_callback) yield d
def render_forms(self, ctx, data): d = iformless.IFormDefaults(ctx).getAllDefaults('insert') d['author'] = 'Anonymous' d['id'] = IBlog(IStore(ctx)).getNextId() return webform.renderForms()