[Grok-dev] zope.schema.Choice & unicode problem

Vladislav Vorobiev mymir.org at googlemail.com
Wed Aug 25 11:38:47 EDT 2010


>> class MyInterface(zope.Interface):
>>
>>
>>     q_type = Choice(
>>         title = u"foobar",
>>         description = "",
>>         vocabulary = vocabulary(
>>       ('1', 'Fehler', u'Fehler'),
>>             ('2', 'Aenderung', u'Änderung'),),
>>
>>         required = False,
>>     )
>>
>> Cheefrocker

I use some helper methods but its realy a zope bug.

For Example:

def getTermsFromStrings(strings):
        if not isinstance(strings, type([])):
                strings = [strings]

        return [SimpleTerm(strings[i][0], str(i), strings[i][1]) for i in
xrange(len(strings))]


def MyValueFactory(context):
    cat   = context.catalog
    a     = []
    for i in cat:
            a.append([i.lastName,  i.lastName+', '+i.firstName])

i.lastName has an unicode value


More information about the Grok-dev mailing list