# HG changeset patch # User Sylvain Thénault # Date 1284373451 -7200 # Node ID d37428222a6325583be958d7c7fe7c595115663d # Parent e2aeb40d59832873842944f59020f0c663babd51 [form fields] option may be a 3-uple (3d element being dict containing widget options) diff -r e2aeb40d5983 -r d37428222a63 web/formfields.py --- a/web/formfields.py Mon Sep 13 11:00:22 2010 +0200 +++ b/web/formfields.py Mon Sep 13 12:24:11 2010 +0200 @@ -410,11 +410,16 @@ if self.sort: vocab = vocab_sort(vocab) # XXX pre 3.9 bw compat - for i, (label, value) in enumerate(vocab): + for i, option in enumerate(vocab): + # option may be a 2 or 3-uple (see Select widget _render method for + # explanation) + value = option[1] if value is not None and not isinstance(value, basestring): warn('[3.9] %s: vocabulary value should be an unicode string' % self, DeprecationWarning) - vocab[i] = (label, unicode(value)) + option = list(option) + option[1] = unicode(value) + vocab[i] = option return vocab def format(self, form):