At the Forge - CMF Types
Over the last few months, we have discussed content management systems (CMS) in general and Zope's content management framework (CMF) in particular. Zope's CMF is designed to give developers the tools they need to create their own content management systems. Of course, anyone who has worked with a CMS knows that even the most proprietary of the bunch requires extensive modification, reworking and customization before it can be used. Zope thus not only reduces the price of the base software, but provides a rich environment that makes it relatively easy to develop and customize the CMS.
When you create a CMF site, you (as the site manager) can add, modify and delete documents. Click on the folder contents link, click on the New... button, indicate which type of document you want to add and what ID it should have and then click on the add button. Enter the metadata (that is, title, description, subject and content type), click on the change & edit button, add some content and you're off and running.
However, although the existing content types are sufficient for simple sites, more sophisticated sites will want to create their own, custom types. CMF provides several ways to do exactly this. This month, we look at types in CMF—how we can work with them, customize their behavior, install new ones and even create new types to handle custom content.
The simplest way to create a new type is to use CMF's built-in, Web-based type extension system. It allows you to create a new type that shares its methods, properties, actions, presentation templates and icons with another type by default. When you create a new type using the Web-based extension system, you can modify any of these items, except for the methods and properties. In other words, the new type you create can have a different look and feel from its parent type, but it continues to behave much as the parent did.
For example, let's go to what is known as the types tool, available by clicking on portal_types within the management interface for a CMF site. If you don't have a CMF site already defined in Zope, you can create one by choosing CMF Site from the Add... menu in the upper-right corner of the Web-based Zope management interface. Once you have created the site, clicking on its icon from within the management interface displays a number of different customization tools, each with an icon that looks like a wrench.
When you first enter the types tool, you see a list of the currently defined CMF types, including folders, documents, news items, links and topics. You can examine and modify the properties and actions associated with these types by clicking on the name of the type you want to change. For example, if you want to examine or change the way the File content type does things, click on File. This brings up a new set of management tabs at the top of the page, with properties (the default) and actions being the only ones not standard to other parts of Zope. Actually, properties is a standard Zope tab, but CMF types have a number of unusual property names.
In addition to the standard properties you expect to see, each type has the following properties that affect what it does:
Icon: a string that describes which icon should be displayed for items of this type.
Product metatype: describes the Zope product meta-name. Meta-names are used in the Add... menu in the Zope Management Interface. This also is the name used in the similar Add... menu in the CMF.
Product name: indicates the Zope product in which the CMF type was defined. Because both the File and News item types were defined in the default CMF installation, they are listed as being in the CMFDefault product. And indeed, if you look in /lib/python/products/CMFDefault, which is a symbolic link to CMF-1.3/CMFDefault in CMF 1.3, you should see both File.py and NewsItem.py, Python modules that define the content types. To see how the initial values for properties are set, look at the factory_type_information variable in any module for any defined CMF type.
Product factory method: describes the method CMF should invoke to create a new instance of the type.
Filter content types and Allowed content types: these work together, even though they are separate properties. Although both of these properties exist for all CMF types, they are relevant only for folder-like objects, such as Folders and Topics. The first, Filter content types, is a boolean value that indicates whether Allowed content types is active. The second, Allow content types, lets you specify which types may be contained within the current type. So if you were interested in creating a folder that would contain only News items, you could do so by clicking yes and then indicating which types may be included.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Astronomy for KDE
- Profiles and RC Files
- Understanding Ceph and Its Place in the Market
- What's Our Next Fight?
- Maru OS Brings Debian to Your Phone
- Snappy Moves to New Platforms
- OpenSwitch Finds a New Home
- Git 2.9 Released
- Mark Geddes' Arduino Project Handbook (No Starch Press)
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide