Hola gente,

Tengo el siguiente problema que creo que debería de estar resuelto, pero no
encuentro la forma:

Tengo un contenido creado con Dexterity en el cual he definido un campo
Dict:

field = schema.Dict(
    title=_(u"Field"),
    key_type=schema.Choice(
        source=PossibleOptions()
    ),
    value_type=schema.Decimal()
)

La definición del source es:

class PossibleOptions(object):
    grok.implements(IContextSourceBinder)

    def __call__(self, context):
        terms = []

        # at this point context is None and therefore raises
        # an exception
        go = context.items()
        if go:
            for option in go.options():
                terms.append(SimpleVocabulary.createTerm(
                    IUUID(option),
                    IUUID(option), option.title.encode('utf-8')))

        return SimpleVocabulary(terms)


El problema es que el context que se pasa al __call__ del vocabulario es
None, por lo que el vocabulario falla.

Alguien tiene alguna idea al respecto?




--
View this message in context: 
http://usarios-plone.2295514.n2.nabble.com/context-es-None-en-un-vocabulario-para-schema-Dict-tp7572678.html
Sent from the Usarios Plone mailing list archive at Nabble.com.
_______________________________________________
Usuarios-Plone mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-usuarios-plone

Responder a