I have two different contexts for a Plone instance.
In the first context there are some ATFolders. Secondly, there are also ATFolders that need to be synchronized with the first context using some subscribers.
In the second context, ATFolders should be aware that they are associated with some folders in the first context.
I was thinking about using setattr in them ( setattr(obj_context1, attr, obj_context2.UID()) ) instead of creating a new Content-Type just to have the ReferenceField attribute (or using archetype.schemaextender ), since that would be too much redundant for just one parameter in a certain context: folders that will have this attribute will not be deleted, for example, from ZODB. They will have a convenient one-state workflow. This attribute is completely hidden from the user, and folders in the second context are programmatically created without user intervention.
This attribute should only exist in the second context, so creating an adapter or a new type of content just for use in this context seems to be too much.
I tend to use setattr for the sake of pragmatism in this particular scenario, but I donβt know if using the setattr approach setattr haunt me in the future (performance, conflicts in architects, etc.)). I mean: if you make an update catalog, update workflow, will this new attribute have a problem?
Any thoughts? Has anyone experienced with setattr in this situation? This attr will and should not be visible, it is only for some control.
source share