[Zope-CMF] Re: [dev] CMF 1.5 roadmap?

Christian Heimes heimes at faho.rwth-aachen.de
Wed Feb 25 21:51:11 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris McDonough wrote:
| - There really should be a representative equivalent of
|   CMFDefault-written-with-Archetypes to make it clear how
|   to write CMF applications with Archetypes.

There is a project called CMFPloneTypes that was started to substitute
the defautl cmf types from CMFDefault, CMFCalendar (Event) and CMFTopic
(Topic + criteria). It's quiet stable and well working.

In the last few weeks I wrote the unit test suit, the migration system
and topic + criteria for CMFPloneTypes. For example the topic (including
the edit views) are implemented with about 36k+ characters using AT
while the CMF implementation has about 49k+ characters.
The edit views for the AT implementation are created using the
archetypes schema of the topic. This means you need only to change the
schema in the class files if you need to alter a criterion. For any
further criteria no one needs to write a new edit template - that's done
automagically.
Using archetypes I was able to focus on the functionality of the
criteria. Most critera just contain the schema and one additional method
that returns the catalog query for the criteria.

The whole product shows how easy it is to create new types with AT that
*DO* focus on the important stuff for most end users:

~ * an easy to understand schema that contains both the fields and the
widgets in an easy to read way

~ * a clear API with easy to remember accessors and mutators for the fields

~ * It's really potty to subclass the cmf plone types to add
functionality and/or new fields

Here is some code (untested):

from Products.CMFPloneTypes.types.PloneDocument import PloneDocument,
ploneDocumentSchema
from Products.CMFCore import CMFCorePermissions
from Products.Archetypes.public import *

myDocSchema = ploneDocumentSchema + Schema((
~    FileField('pdf',
~              required = 0,
~              widget = FileWidget(description = "pdf version of the
document",
~                                  label= "PDF",)
~    ))

class MyDocument(PloneDocument):
~    schema = myDocSchema

~    actions = ({
~       'id'          : 'view',
~       'name'        : 'View',
~       'action'      : 'string:${object_url}/mydoc_view',
~       'permissions' : (CMFCorePermissions.View,)
~        })

registerType(MyDocument)

That's all :)

Even for a person with less knowledge of python, zope and cmf it's
blindingly easy to create new types using copy 'n paste.

Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFAPV8e9aLWrfOU0PgRAk2iAJ9aO5VvoyxDUZPw+n5SYaQ3Zy4FlgCeI3HN
atyUUSHRjxscnqSQWP0sZXA=
=iQCY
-----END PGP SIGNATURE-----




More information about the Zope-CMF mailing list