Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
except AttributeError:
default_type = "robohash"
schema.add(
colander.SchemaNode(
colander.String(),
default=default_type,
name="gravatar_default_type",
title=_("Gravatar default type"),
description=_(
"gravatar_default_description",
default="What to use in case users don't have a gravatar image registered. "
"See: ${url} for more information and examples.",
mapping={"url": "https://gravatar.com/site/implement/images"},
),
widget=deform.widget.RadioChoiceWidget(values=_GRAVATAR_CHOICES),
)
description = "Find and process noun chunks in text."
MODES = (
('tokenize', 'Tokenize noun chunks in text'),
('append', 'Add tokenized noun chunks to text'),
('replace', 'Replace all text with found tokenized noun chunks')
)
mode = colander.SchemaNode(
colander.String(),
validator=colander.OneOf([x[0] for x in MODES]),
default=MODES[0][0],
missing=MODES[0][0],
title="Operating mode",
widget=deform.widget.RadioChoiceWidget(values=MODES)
)
drop_determiners = colander.SchemaNode(
colander.Bool(),
default=True,
missing=False,
label="Determiners are leading word particles (ex: the)",
title='Drop determiners',
)
min_freq = colander.SchemaNode(
colander.Int(),
title="Minimum frequency count",
description="""Ignore phrases with lower count then given number""",
default=1,
)
@colander.deferred
def deferred_component_widget(node, kw):
loader = kw['loader']
components = loader.ep_parser.get_components()
values = []
for component_name, component in components:
title = getattr(component, 'title', component_name)
values.append((component_name, title))
return deform.widget.RadioChoiceWidget(values=values)
from deform.widget import RadioChoiceWidget
class StarWidget(RadioChoiceWidget):
#FIXME: the resources for this widget is now hardcoded into main.pt, they should be added through deform resource manager
#requirements = ( ('jquery.rating', None), )
template = 'star_choice'
readonly_template = 'readonly/star_choice'
mode = colander.SchemaNode(
colander.String(),
validator=colander.OneOf([x[0] for x in MODES]),
default=MODES[0][0],
missing=MODES[0][0],
title="Operating mode",
widget=deform.widget.RadioChoiceWidget(values=MODES)
)
level = colander.SchemaNode(
colander.Int(),
default=LEVELS[0][0],
missing=LEVELS[0][0],
title='N-gram level',
widget=deform.widget.RadioChoiceWidget(values=LEVELS),
description='How many words to include in phrase detection',
)
min_count = colander.SchemaNode(
colander.Int(),
default=5,
missing=5,
title='Minimum number',
description='Ignore all words with total count lower then this',
)
threshold = colander.SchemaNode(
colander.Float(),
default=10.0,
missing=10.0,
title='Threshold',
title = "#%s - %s" % (prop.get_field_value("aid"), prop.text)
choices.add((prop.uid, title))
poll_wf_state = self.context.get_workflow_state()
if poll_wf_state == "ongoing":
proposal_title = _("Vote for one")
else:
proposal_title = _("You can't change your vote now.")
class Schema(colander.Schema):
widget = deform.widget.FormWidget(
template="form_modal", readonly_template="readonly/form_modal"
)
proposal = colander.SchemaNode(
colander.String(),
validator=colander.OneOf([x[0] for x in choices]),
widget=deform.widget.RadioChoiceWidget(values=choices),
title=proposal_title,
description="",
)
return Schema()
def inline_radiochoice(self):
class Schema(colander.Schema):
choice = colander.SchemaNode(
colander.String(),
widget=deform.widget.RadioChoiceWidget(
values=[('a', 'Arrow'),
('b', 'Brick'),
('c', 'Cardamom')],
inline=True),
description='Pick one')
schema = Schema()
form = deform.Form(schema, buttons=('submit',))
return self.render_form(form)
def deferred_ai_layout_right_widget(node, kw):
request = kw['request']
choices = _get_choices(request, 'ai_widgets')
choices.append(('', _(u"")))
return deform.widget.RadioChoiceWidget(values=choices)