[SOLVED] Resolving RelationValue -> IIntIds ComponentLookupError

A customer site has collection portlet with an assignment where I am trying to resolve the reference to target collection

(Pdb) assignment
<ugent.portlet.collection.portlet.UGentCollectionAssignment object at 0x7fdc17c92a28>

The target_collection value raises an error upon to_object:


(Pdb) assignment.__dict__
{'target_collection': <z3c.relationfield.relation.RelationValue object at 0x7fdc17c92aa0>, '__annotations__': <BTrees.OOBTree.OOBTree object at 0x7fdc17c89850>, 'random': False, 'exclude_context': True, 'show_more': True, 'header': u'News about Ufora', 'limit': 4, 'show_more_text': u'More news ...', '__name__': u'nieuws-over-ufora', '__parent__': <PortletAssignmentMapping at ++contextportlets++plone.rightcolumn>, 'show_dates': False}

(Pdb) assignment.target_collection
<z3c.relationfield.relation.RelationValue object at 0x7fdc17c92aa0>
(Pdb) assignment.target_collection.to_object
*** ComponentLookupError: (<InterfaceClass zope.intid.interfaces.IIntIds>, '')

However there the to_id value available:

(Pdb) assignment.target_collection.__dict__
{'to_id': 1608143906, 'from_attribute': None, '__parent__': None}

Any idea how to resolve the id -> object?

Obviously getUtility(IIntIds) does not find the IntId-catalog in your site. That happens when plone.app.intid is not installed or was uninstalled. You could also run the code in:

plone.app.intid was actually installed. Just the standard

from zope.component.hooks import setSite

portal = app.plone_portal
setSite(portal)

was missing .

Then you should probaby have stated that you code was from a script and not code run from within the application...

Shit happens when you're in panic :slight_smile: