cybertools/composer/schema
helmutm 154f2dcead minor modifictaions and extensions for the tum.sm project
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1936 fd906abe-77d9-0310-91a1-e0d9ade77398
2007-08-20 10:03:32 +00:00
..
browser minor modifictaions and extensions for the tum.sm project 2007-08-20 10:03:32 +00:00
__init__.py more on cybertools.reporter: control via the field's renderFactory 2007-05-21 17:28:16 +00:00
client.py work in progress: service managment with composer.schema for tumsm 2007-07-31 09:15:48 +00:00
configure.zcml provide adapter declarations for client and instance stuff 2007-08-02 20:19:09 +00:00
field.py extending composer and organize.schema to provide basis for tumsm 2007-07-29 13:28:50 +00:00
instance.py work in progress: service managment with composer.schema for tumsm 2007-07-31 09:15:48 +00:00
interfaces.py minor adjustments of interfaces (schemas) 2007-08-17 16:58:17 +00:00
README.txt more on cybertools.reporter: control via the field's renderFactory 2007-05-21 17:28:16 +00:00
schema.py work in progress: composer.schema, organize.service for tumsm 2007-08-01 07:47:47 +00:00
tests.py removed Instance; added schema package 2007-05-15 09:36:02 +00:00

===========================
Schema and Field Management
===========================

  ($Id$)

  >>> from cybertools.composer.schema import Schema
  >>> from cybertools.composer.schema import Field

We start with setting up a schema with fields.

  >>> serviceSchema = Schema(
  ...     Field(u'title', renderFactory=None),
  ...     Field(u'description'),
  ...     Field(u'start'),
  ...     Field(u'end'),
  ...     Field(u'capacity'),
  ... )

For using a schema we need some class that we can use for creating
objects.

  >>> class Service(object):
  ...     pass

The schema will be connected with an object via an instance adapter.

  >>> from cybertools.composer.schema.instance import Editor
  >>> from zope import component
  >>> component.provideAdapter(Editor, (Service,), name="service.edit")

  >>> srv = Service()
  >>> inst = component.getAdapter(srv, name='service.edit')
  >>> inst.template = serviceSchema
  >>> inst.applyTemplate()
  title -
  description -
  start -
  end -
  capacity -