Ticket #11395 (confirmed Bug)
relations behavior needs improvement
Reported by: | runyaga | Owned by: | optilude |
---|---|---|---|
Priority: | critical | Milestone: | 4.x |
Component: | Dexterity | Version: | 4.1 |
Keywords: | dexterity, staging, relations | Cc: | fafhrd91, deo |
Description
using automatic versioning or staging;
the z3c.relationsfield is storing aqwrappers. needed to monkeypatch the _setRelations to aq_base object for dexterity/relations to work correctly.
if you save an object in ZODB first (all obj get unwrapped at ZODB level) this will work fine. But if your cloneByPickle the object BEFORE it gets stored -- you will see this failure with relations.
almost no one will be able to figure this out.
Change History
comment:4 Changed 5 years ago by wclxlus
If you want to get object from RelationValue, it has a work around way to get them regardless aqwrappers through intids.
sample code below:
catalog = component.queryUtility(ICatalog) intids = component.queryUtility(IIntIds) all_related_items = [] obj_id = intids.getId(aq_base(self.context)) # related items rels = list(catalog.findRelations( {'from_id':obj_id})) for rel in rels: try: ob = intids.getObject(rel.to_id) all_related_items.append(ob) except: continue # back references back_rels = list(catalog.findRelations( {'to_id': obj_id})) for rel in back_rels: try: ob = intids.getObject(rel.from_id) all_related_items.append(ob) except: continue self.all_related_items = all_related_items
comment:6 Changed 4 years ago by kleist
- Keywords dexteritystagingrelations added; dexterity staging relations removed
- Status changed from new to confirmed
- Version set to 4.1
comment:7 Changed 4 years ago by kleist
- Keywords dexterity, staging, relations added; dexteritystagingrelations removed
comment:8 Changed 4 years ago by kleist
How can this be "critical", when still open since twenty months?
or, rephrased:
How can this still be open since twenty months, when "critical"?
comment:9 Changed 3 years ago by jbaumann
I think this is fixed with https://github.com/plone/plone.app.versioningbehavior/commit/3f4002200ce9c84020cf8097f002798bff398add
@runyaga could you verify that it is fixed?
comment:10 Changed 3 years ago by kleist
Alan?
comment:11 Changed 3 years ago by kleist
Could anybody please confirm that this has been fixed?