Hi all,

I have build an List of Choices and it works well:
in interface:
    hostlist = List(
        title=_(u"Host List"),
        description=_(u"Host List"),
        value_type = Choice(
            title=_(u"Host"),
            description=_(u"Host"),
            required = True,
            vocabulary = "IkGroupHosts"),
        required=False)

vocabulary:
def HostsVocabulary(context):
    dynHostList = []
    for (oid, oobj) in iid.items():
        if IIkHost.providedBy(oobj.object):  
            dynHostList.append( SimpleTerm( oobj.object.getIkTitle(), 
oobj.object.getIkTitle()))
    return SimpleVocabulary( dynHostList)  

object has string-result:
hostlist        [u'titan', u'radon']

now i want to store references in (my new) lIst  by vocabulary:

def HostsVocabulary(context):
    dynHostList = []
    iid = zapi.getUtility( IIntIds, 'iid')
    for (oid, oobj) in iid.items():
        if IIkHost.providedBy(oobj.object):  
            dynHostList.append( SimpleTerm( 
KeyReferenceToPersistent(oobj.object), oobj.object.getIkTitle()))
    return SimpleVocabulary( dynHostList)  

when commit the form:
[...]
  File "/opt/ikom/Zope3/src/zope/schema/_bootstrapfields.py", line 133, in 
validate
    if value == self.missing_value:
  File "/opt/ikom/Zope3/src/zope/app/keyreference/persistent.py", line 56, in 
__cmp__
    if self.key_type_id == other.key_type_id:
AttributeError: 'NoneType' object has no attribute 'key_type_id'


Any idea or other way of storing references in my Hostlist?

Markus
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to