Archetypes fieldtraverser
Project description
Overview
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.
Use Cases
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.
Usage
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):
obj/++atfield++FIELDNAME
or
obj/++atfield++FIELDNAME-STORAGENAME
Example
To access an original image from a field named ‘photo’:
obj/++atfield++photo
To access its thumbnail with size named ‘thumb’:
obj/++atfield++photo-thumb
Dependencies
Products.Archetypes
Installation
Install like any other Plone egg and import the GenericSetup profiles in ZMI, portal_setup.
Known Issues
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
Copyright (c) 2008: BlueDynamics Alliance, Austria
Alan Farmer (c) 1997 from Bearos Records for plone.jpg
Credits
Jens Klein <jens@bluedynamics.com>
Johannes Raggam <johannes@bluedynamics.com>
Robert Niederreiter <rnix@squarewave.at>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for archetypes.fieldtraverser-0.4.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7be7baa85116f93d36705c7a79080e2daf7fd8814ac6c5acb68b88ad9e0fc553 |
|
MD5 | 84ca777961d505841eb9544600799843 |
|
BLAKE2b-256 | 86ab35796a75108fbc0e2a40e362b267d62aea664569f20d7cd038509155a07e |