AT Relation Field¶
Working with David Brennan on two-way references and relationships
between Archetypes and Dexterity.
Next to the method for defining content type schema and installing content types in a portal, the Archetypes reference engine has been one of the more valuable and widely used bits of Archetypes. Unfortunately, the AT reference engine is also a bit heavy weight and too tightly coupled to AT, making it hard to re-use fruitfully.
The zc.relation package provides a very powerful library for establishing connections, read references and relationships, between objects. It also provides for walking and searching networks of connections. It’s all very cool. It’s also very generalized which is a good thing since it can be used in so many different ways. This does, however, make it very difficult to approach. It’s my hope that as we find ways to integrate zc.relation into the Plone stack, that others will find clever ways to use zc.relation’s powerful network traversing to do some unexpected things. So the combination of zc.relation and z3c.relationfield provides not only a more widely re-usable, loosely coupled replacement for the AT reference engine, but a much more powerful tool with capabilities far beyond what could ever be achieved with the AT reference engine.
One of the concerns which kept coming up was that getting rid of the AT reference engine meant getting rid of UIDs. With UUID use taking off and finding new and interesting uses it’s important that we provide some sort of UUID system, but the AT reference engine is large and heavy and very much unnecessary to support UUIDs. UUIDs are very simple and should not be coupled to any particular framework or larger library when they can so easily be a very small library of their own easily integrated in lots of ways. So the question of how we want to support UUIDs and the question of what to do with the AT reference engine should no be conflated, they can and should be addressed separately.
Dexterity integrates the z3c.relationfield package to provide widgets for specifying zc.relation connections between content on z3c.form forms. This allows Dexterity content to establish relationships and references to both Dexterity and AT content. There is, however, no zc.relation field and widget for AT content so there’s no way for AT content to establish relationships or references to Dexterity content.
David Brennan set out to build an AT field and widget that could make use of zc.relation relations and on the latter half of the second day I joined him for some pair programming. By lunch on the third day, we had working extensions of Products.Archetypes.Field.ReferenceField and Products.Archetypes.Widget.ReferenceWidget which used zc.relation behind the scenes.
Next up is an extension of Products.ATReferenceBrowserWidget which works with zc.relation. Once that is working, archetypes.schemaextender can be used with one which uses zc.relation. Finally, a migration can be to offer a ZCML file which would replace the ATCT relatedItems field implemented to migrate existing AT references to the zc.relation back-end.
Once that is completed archetypes.z3crelationfield can be used as a proving ground for the possibility of removing the reference engine from Archetypes itself. Once it’s polished and the AT reference engine removed, the way will be paved to remove one of the hurdles which has made it so hard for newer content type frameworks to make an entrance on the Plone scene.
Updated on 19 March 2010
Imported from Plone on Mar 15, 2021. The date for this update is the last modified date in Plone.
Commentscomments powered by Disqus