@view_config(renderer="templates/form.pt", name="select_with_unicode")
@demonstrate("Select Widget (with unicode)")
def select_with_unicode(self):
choices = (
("", "- Select -"),
(unicode("ハバネロ", "utf-8"), "Habanero"),
(unicode("ハラペーニョ", "utf-8"), "Jalapeno"),
("chipotle", "Chipotle"),
)
class Schema(colander.Schema):
pepper = colander.SchemaNode(
colander.String(),
widget=deform.widget.SelectWidget(values=choices),
)
schema = Schema()
form = deform.Form(schema, buttons=("submit",))
return self.render_form(form)