# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1236766559 -3600 # Node ID 2a93712a6f8b14e83877b21785f92c45d5d4c3f9 # Parent 21d4d5e6aa4534662b66e94e7dbe0e604c862a48 fix format field vocabulary diff -r 21d4d5e6aa45 -r 2a93712a6f8b web/form.py --- a/web/form.py Wed Mar 11 11:15:08 2009 +0100 +++ b/web/form.py Wed Mar 11 11:15:59 2009 +0100 @@ -21,6 +21,7 @@ from cubicweb.utils import ustrftime from cubicweb.selectors import yes, match_form_params, non_final_entity from cubicweb.view import NOINDEX, NOFOLLOW, View, EntityView, AnyRsetView +from cubicweb.schema import FormatConstraint from cubicweb.common.registerers import accepts_registerer from cubicweb.common.uilib import toggle_action from cubicweb.web import stdmsgs @@ -544,11 +545,15 @@ # if fckeditor is used and format field isn't explicitly # deactivated, we want an hidden field for the format widget = HiddenInput() + choices = None else: # else we want a format selector # XXX compute vocabulary widget = Select - field = StringField(name=self.name + '_format', widget=widget) + req = form.req + choices = [(req._(format), format) for format in FormatConstraint().vocabulary(req=req)] + field = StringField(name=self.name + '_format', widget=widget, + choices=choices) form.req.data[self] = field return field