ATCustomTypes
Category: Code examples, Development tools
—
Other products by this author
Current release
No stable release available yet.
Experimental releases
Upcoming and alpha/beta/candidate releases
- Alpha releases should only be used for testing and development.
- Beta releases and Release Candidates are normally released for production testing, but should not be used on mission-critical sites.
- Always install on a separate test server first, and make sure you have proper backups before installing.
Project Description
- Project resources
Why does it exist?
While you can get a long way using Plone's default content types, sooner or later you often run into the situation that you need to adapt (some of) these types, most notably by changing their schema in some way like adding or hiding a field, changing a widget's description etc.
Since the schema in particular cannot be customized through the web, you either need to monkey patch the existing types (not recommended) or subclass them. What you then usually end up doing is to create custom types that you use instead of the default ones leaving it to you to make sure that all settings like the add permissions or the workflow assignments are as they used to be. Furthermore you have a migration probelm as soon as you have content generated using Plone's default types already.
Using ATCustomTypes you don't need to worry about these issues. What's more, making changes to Plone's default types in a sane way by providing your own product that even includes migration for already existing instances is just a matter of minutes with ATCustomTypes.
Dependencies
None except Plone itself, of course (including ATContentTypes). Tested with the Plone 2.5 and 3.0 series.
How to use it
Download ATCustomTypes from http://plone.org/products/atcustomtypes
unpack the archive and copy it to your site's Products folder.
Or - better yet - import it into your own code repository. In the
content subpackage you find the modules containing the wrapper classes
for the individual types. It is in there where you want to make changes
to customize the existing types.
Installation
Like any other Plone product using the quickinstaller, aka via site setup
to add-on Products and then you select ATCustomTypes and press install.
How it works
ATCustomTypes tries to be minimaly intrusive. All it does is to provide
wrapper classes for the default content types that get hooked up by changing
only to Product name value on the respective Factory Type Information
objects in the types tool. This is sufficient to make Plone using the
constructors provided by ATCustomTypes instead of those from ATContentTypes.
On install, all existing content items that are known to the catalog are
migrated to the new types by simply changing their assigned base class.
Hope this saves some people some time!
Enjoy,
Raphael