# HG changeset patch # User Sylvain Thénault # Date 1253548968 -7200 # Node ID 428f9511855645f41033ab413d2906c00561c990 # Parent b1fd9d4ef579d5b6aaedf1948c0b3d5589d5d9f7 fix vocab param to avoid deprecation warning diff -r b1fd9d4ef579 -r 428f95118556 schema.py --- a/schema.py Mon Sep 21 18:02:21 2009 +0200 +++ b/schema.py Mon Sep 21 18:02:48 2009 +0200 @@ -958,9 +958,12 @@ NEED_PERM_FORMATS = [_('text/cubicweb-page-template')] @monkeypatch(FormatConstraint) -def vocabulary(self, entity=None, req=None): - if req is None and entity is not None: +def vocabulary(self, entity=None, form=None): + req = None + if form is None and entity is not None: req = entity.req + elif form is not None: + req = form.req if req is not None and req.user.has_permission(PERM_USE_TEMPLATE_FORMAT): return self.regular_formats + tuple(NEED_PERM_FORMATS) return self.regular_formats diff -r b1fd9d4ef579 -r 428f95118556 web/formfields.py --- a/web/formfields.py Mon Sep 21 18:02:21 2009 +0200 +++ b/web/formfields.py Mon Sep 21 18:02:48 2009 +0200 @@ -283,7 +283,7 @@ # else we want a format selector fkwargs['widget'] = Select() fcstr = FormatConstraint() - fkwargs['choices'] = fcstr.vocabulary(req=req) + fkwargs['choices'] = fcstr.vocabulary(form=form) fkwargs['internationalizable'] = True fkwargs['initial'] = lambda f: f.form_field_format(self) field = StringField(name=self.name + '_format', **fkwargs)