Download presentation
Presentation is loading. Please wait.
1
Archetypes Next Generation Content Types for Zope 2
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 ● Simple Schema, Including things expected by Zope and 1 additional Field ● Schema are active objects and drive the inner workings of the object schema = BaseSchema + Schema(( TextField('body', required=1, searchable=1, widget = RichWidget(), ), ))
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
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.