Manage configuration of browser views
This add-on does not provide feature to Plone. It is intended to plone add-ons developers.
It provides base class to let your view being configurable (ie have 'settings').
- Configuration providers
- Configuration structure defined with zope.interface & zope.schema
- Store configuration using plugins
- Generated form from the schema to let owner configure the current view
Notes on VERSIONS
3.0 is a back to 1.0.
2.0 branch was about to use plone.app.registry on the context using collective.registry. After doing this the addon loose the ability to have optimized settings (mixin of globals and locals). So lets revert this and continue the 1.0 in 3.0 !
Why doing this in an add-on
Because most of the time developers faced to this issue store data in the content type, or with annotation on context without trying to optimize, or without form, ...
How it works
This add-ons define three components:
The main idea, is you just have to create an zope.interface to define settings schema and set this schema in the 'settings_schema' attributes of the view.
class IMyViewSettings(interface.Interface): width = schema.ASCIILine(title=u"Width", default='620') height = schema.ASCIILine(title=u"Height", default='620') class MyView(ConfigurableBaseView): settings_schema = IMyViewSettings def width(self): return self.settings.width def height(self): return self.settings.height
This component is responsible to return settings. It has been implemented in different adapters
Provider (no named adapter): this provider load default values from the interface fields defaults values and it let other providers override values. It is an aggregation of all providers specified in the view throw the settings_providers attribute. Warning: The order is important, each settings are taken from the last provider which provide it.
'site.plone.app.registry': this provider return values from plone.app.registry (you have to register your settings_schema as records in registry.xml)
'context.zope.app.annotation': this provider return values stored in annotation on the context of the view.
This component is an extension of IConfigurationProvider with the write settings capabilities (throw its 'set' method).
'context.zope.app.annontation': this mutator store the configuration in the context of the view.
This component is implemented in a browserview you are supposed to inherits from in your own browser view.
The default behavior is to use 'context.zope.app.annotation' as mutator and the following providers:
You can set the variable name throw the jsvarname attribute of your browserview.
You will find examples in the following addons:
- JeanMichel FRANCOIS aka toutpt <firstname.lastname@example.org>
- Radim Novotny aka naro
- Fix configuration error by forcing the load zcml of CMFDynamicViewFTI [toutpt]
- protect configviews form with a permission [toutpt]
- add support for viewlet [toutpt]
- Revert to 1.0 internal design. [toutpt]
- Use collective.registry instead of provider/mutator [toutpt]
- add new classifiers [toutpt]
- fix tests [toutpt]
- fix issue making edit configuration not working [naro]
- Optimization of storage: defaults are now based on all provider except zope.app.annotation [toutpt]
- fix case where site.plone.app.registry are not set (value was set to None) [toutpt]
- Fix config form (http://stackoverflow.com/q/6524304/622081)
- Initial release
Released Apr 30, 2013 — tested with Plone 4.1, Plone 4.2
- Get collective.configviews for all platforms
- If you are using Plone 3.2 or higher, you probably want to install this product with buildout. See our tutorial on installing add-on products with buildout for more information.
|3.0a1||More about this release…||
|3.0.2||Apr 30, 2013||More about this release…||
|3.0.1||Apr 29, 2013||More about this release…||
|3.0||Mar 25, 2013||More about this release…||
|2.0||Jan 30, 2012||Use collective.registry instead of provider/mutator More about this release…||
|1.0b4||More about this release…||GPL||beta|
|1.0b3||More about this release…||GPL||beta|
|1.0b2||More about this release…||GPL||beta|
|1.0b1||first beta release More about this release…||