def add_behavior_relations(obj, event): """Register relations in behaviors. This event handler fixes a bug in plone.app.relationfield, which only updates the zc.catalog when an object gets modified, but not when it gets added. """ for behavior_interface, name, relation in extract_relations(obj): _setRelation(obj, name, relation)
def add_relations_to_relation_catalog(self, old_object, new_object): for behavior_interface, name, relation in extract_relations(new_object): if isinstance(relation, (str, unicode)): # We probably got a UID, but we are working with intids # and can not do anything with it, so we skip it. LOG.warning('Got a invalid relation ({!r}), which is not ' 'z3c.relationfield compatible.'.format(relation)) continue _setRelation(new_object, name, relation)
def add_relations_to_relation_catalog(self, old_object, new_object): for behavior_interface, name, relation in extract_relations( new_object): if isinstance(relation, (str, six.text_type)): # We probably got a UID, but we are working with intids # and can not do anything with it, so we skip it. LOG.warning('Got a invalid relation ({!r}), which is not ' 'z3c.relationfield compatible.'.format(relation)) continue _setRelation(new_object, name, relation)
def add_relations_to_relation_catalog(self, old_object, new_object): for behavior_interface, name, relation in extract_relations(new_object): _setRelation(new_object, name, relation)