I have a relatively large form that I've recently been playing with to try
and get more control over the layout and behavior. After some recent
changes, I started getting a peppercorn exception"ValueError: Not enough
end markers" on parse(controls) in field.py.
The code that causes the problem is:
preopsym_yn = colander.SchemaNode(
colander.String(),
title='Preoperative Symptoms?',
description='Select Yes to reveal symptoms',
widget=treat.models.widgets.RadioChoiceWidget(values=YES_NO,
css_class='preopsym_yn'),
oid='preopsym_yn'
)
If I change that oid, the error goes away, but it doesn't collide with another
widget id (explicitly named or not).
My Widget is fairly simple, I just made some minor changes to the template to
allow explicit control over it's appearance:
class RadioChoiceWidget(deform.widget.SelectWidget):
"""
"""
template = 'treat.views:templates/widgets/radio_choice.pt'
readonly_template = 'treat.views:templates/widgets/readonly/radio_choice.pt'
css_class="toggle"
And the template look fine too:
style style|field.widget.style;
inline getattr(field.widget, 'inline', False);"
tal:omit-tag="not inline">
${field.start_rename()}
<div tal:repeat="choice values | field.widget.values"
tal:omit-tag="inline"
class="radio">
<label for="${oid}-${repeat.choice.index}"
tal:define="(value, title) choice"
tal:attributes="class inline and 'radio-inline'">
<input tal:attributes="checked value == cstruct;
class css_class;
style style;"
type="radio"
name="${oid}"
value="${value}"
id="${oid}-${repeat.choice.index}"/>
${title}
</label>
</div>
${field.end_rename()}
</div>
</div>
I don't personally understand what peppercorn is yet, so I don't understand the
error message at all.
Any thoughts? Also, this is a lot more complicated that is probably typical.
However, if you want better control over the layout of your widgets, is this
the right way to approach it?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.