The archetypes.fieldtraverser is used to traverse to an Archetypes field and access its storage.
It patches Products.Archetypes so that it uses the fieldtraverser for access to fields.
- Access to images, files or other binary data via AnnotationStorage instead of traditional AttributeStorage. archetypes.fieldtraverser eliminates the need to hack __bobo_traverse__ for this. Advantage: When accessing objects with binary data stored in an AttributeStorage, much binary data chunks are loaded regardless if they are used. When doing this quite often the ZODB is unnecessarily stressed.
- You can use archetypes.fieldtraverser for simple Web Services which return just the content of Archetypes fields without the HTML rendered by widgets.
- Impress your friends by easily accessing field-contents via URLs.
In an URL this traverser can be used to access a fields data by use of the fieldname and the storage variant if needed (such as image sizes):
To access an original image from a field named ‘photo’:
To access its thumbnail with size named ‘thumb’:
Install like any other Plone egg and import the GenericSetup profiles in ZMI, portal_setup.
The ImageWidget, FileWidget and RichWidget are patched to use the ++atfield++FIELDNAME notation for accessing binary contents. This patch is done via updating the fields’ _properties which is then copied in the concrete schematas. But our default patch mechanism does not affect ATContentTypes (and possibly other ConentTypes too) because they are loaded by Zope BEFORE the patches are applied. This happens also for eggified products in Plone3.2 because Products.ATContentTypes is being recognised as a Product by Zope/Five because of the “Products” namespace. Therefore Products.ATContentTypes is loaded BEFORE any eggs are loaded. So we have to patch the concrete ATContentTypes too. See patch.py for more information.
Please note that RichWidget has the ability to upload and download files, and therefore we also provide custom fieldtraverser aware widgets. BUT the upload/download feature is deactivated by default in the RichWidget templates and settings. The RichWidget patching is done just for completeness.
So, if you include your own Products or eggs in the “Products” namespace you’ll also have to patch your content types to use our fieldtraverser aware widgets. With this in mind using this product should not be a problem.
For your pleasure
An “Easter egg” can be found when opening “++resource++plone.jpg” in your Plone site. For more information read archetypes/fieldtraverser/tests/plone.jpg.CREDITS
Copyright (c) 2008: BlueDynamics Alliance, Austria
Alan Farmer (c) 1997 from Bearos Records for plone.jpg