414 vocab = [(label and form._cw._(label), value) |
414 vocab = [(label and form._cw._(label), value) |
415 for label, value in vocab] |
415 for label, value in vocab] |
416 if self.sort: |
416 if self.sort: |
417 vocab = vocab_sort(vocab) |
417 vocab = vocab_sort(vocab) |
418 # XXX pre 3.9 bw compat |
418 # XXX pre 3.9 bw compat |
419 for i, (label, value) in enumerate(vocab): |
419 for i, option in enumerate(vocab): |
|
420 # option may be a 2 or 3-uple (see Select widget _render method for |
|
421 # explanation) |
|
422 value = option[1] |
420 if value is not None and not isinstance(value, basestring): |
423 if value is not None and not isinstance(value, basestring): |
421 warn('[3.9] %s: vocabulary value should be an unicode string' |
424 warn('[3.9] %s: vocabulary value should be an unicode string' |
422 % self, DeprecationWarning) |
425 % self, DeprecationWarning) |
423 vocab[i] = (label, unicode(value)) |
426 option = list(option) |
|
427 option[1] = unicode(value) |
|
428 vocab[i] = option |
424 return vocab |
429 return vocab |
425 |
430 |
426 def format(self, form): |
431 def format(self, form): |
427 """return MIME type used for the given (text or bytes) field""" |
432 """return MIME type used for the given (text or bytes) field""" |
428 if self.eidparam and self.role == 'subject': |
433 if self.eidparam and self.role == 'subject': |