web/formfields.py
branchstable
changeset 3347 428f95118556
parent 3337 09d98666f9b3
child 3388 b8be8fc77c27
child 3496 35a67ac6efe8
equal deleted inserted replaced
3346:b1fd9d4ef579 3347:428f95118556
   281                 fkwargs['initial'] = 'text/html'
   281                 fkwargs['initial'] = 'text/html'
   282             else:
   282             else:
   283                 # else we want a format selector
   283                 # else we want a format selector
   284                 fkwargs['widget'] = Select()
   284                 fkwargs['widget'] = Select()
   285                 fcstr = FormatConstraint()
   285                 fcstr = FormatConstraint()
   286                 fkwargs['choices'] = fcstr.vocabulary(req=req)
   286                 fkwargs['choices'] = fcstr.vocabulary(form=form)
   287                 fkwargs['internationalizable'] = True
   287                 fkwargs['internationalizable'] = True
   288                 fkwargs['initial'] = lambda f: f.form_field_format(self)
   288                 fkwargs['initial'] = lambda f: f.form_field_format(self)
   289             field = StringField(name=self.name + '_format', **fkwargs)
   289             field = StringField(name=self.name + '_format', **fkwargs)
   290             req.data[self] = field
   290             req.data[self] = field
   291             return field
   291             return field