1 / 14

Archetypes

Next Generation Content Types for Zope 2. Archetypes. Goals. Simple, reusable framework Easy maintenance Rapid Development. Solution. Simple, flexible Schema Reasonable default policy Keep separate concerns separate Normalized content framework. Implementation. Components Fields

Télécharger la présentation

Archetypes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Next Generation Content Types for Zope 2 Archetypes

  2. Goals • Simple, reusable framework • Easy maintenance • Rapid Development

  3. Solution • Simple, flexible Schema • Reasonable default policy • Keep separate concerns separate • Normalized content framework

  4. Implementation • Components • Fields • Widget System • Validation • Storage • References • Transformation • Schema

  5. Field • Fields encapsulate the policy of a single data item • Type mapping • (Ex: String to date or string to int) • Properties • (Ex: required, vocabulary, searchable) • TextField('body')

  6. Widgets • Flexible, dynamic presentation elements associated with each field • Defined as ZPT macros and callable through the schema • TextField('body', widget=StringWidget()) • metal:use-macro=”python:here.widget('body', mode='view')”

  7. Validation • Validation can be handled a number of ways • Custom validation • For field 'body' implement a method validate_body • Validation Tool • StringField('url', validators=('isURL',)

  8. Storage • Sometimes we know that certain fields require special types of storage. • TextField('body', strorage=SQLStorage(...)) • Can control if elements appear as ObjectManaged elements or not • Store large objects in files or databases and not ZODB

  9. References • The ability to explicitly link objects to one another • Can define relationships between any Archetypes based objects • Forward and Backwards references • Tracks move, rename, copy, delete as expected

  10. Transformation • Content can be the product of complex transformations and this is handled seamlessly by the framework • Supported by a pluggable interface • Sample supported formats include • Office Products • (Re)Structured Text • DocBook • RTF

  11. Schema schema = BaseSchema + Schema(( TextField('body', required=1, searchable=1, widget = RichWidget(), ), )) • Simple Schema, Including things expected by Zope and 1 additional Field • Schema are active objects and drive the inner workings of the object

  12. Schema • A class generator process each object providing hooks into the schema where methods are missing. • getBody might transparently map to • self.Schema()['body'].get(self) • This means that custom field implementations can support rich behaviors shared across projects.

  13. Future Directions • Better Transformation intergration • TTW Schema management • UML <-> XMI <-> Archetypes • XML Schema <-> Archetypes

  14. Questions • Also see • http://sf.net/projects/archetypes • http://www.plone.org/ • http://cmf.zope.org • http://zope.org

More Related