Serialization of schema changes
===============================

This package defers to plone.schemaeditor for the actual editing of Zope 3
schemata.  plone.schemaeditor raises SchemaModifiedEvents when modifications
are made to the schema, and this package registers handlers for those events,
to serialize the modified schema into XML on the type FTI (using the
plone.supermodel API).

Let's make sure that those event handlers are working properly.  We'll need
a dummy Dexterity FTI and schema, and a plone.schemaeditor schema context::

  >>> portal = layer['portal']
  >>> from plone.dexterity.fti import DexterityFTI
  >>> fti = DexterityFTI('dummy')
  >>> portal.portal_types._setObject('dummy', fti)
  'dummy'
  >>> fti.model_source = '''<model xmlns="http://namespaces.plone.org/supermodel/schema"><schema><field name="title" type="zope.schema.TextLine"><title>Title</title></field></schema></model>'''
  >>> schema = fti.lookupSchema()
  >>> from plone.app.dexterity.browser.types import TypeSchemaContext
  >>> schema_context = TypeSchemaContext(schema, request=None)
  >>> schema_context.fti = fti
  >>> schema_context.schemaName = u''

Confirm the SchemaModifiedEvent on a schema context is handled correctly::

  >>> schema['title'].title = u'Change1'
  >>> from zope.event import notify
  >>> from plone.schemaeditor.utils import SchemaModifiedEvent
  >>> notify(SchemaModifiedEvent(schema_context))
  >>> 'Change1' in fti.model_source
  True
