================
atschema builder
================

Build an archetype from scratch, and use paster to add a contenttype::

    >>> paster('create -t archetype plone.example --no-interactive')
    paster create -t archetype plone.example --no-interactive
    ...
    >>> cd('plone.example')
    >>> paster('addcontent contenttype --no-interactive') # doctest: +ELLIPSIS
    paster addcontent contenttype --no-interactive
    ...
          Inserting from types.xml_insert into...
    ...
    >>> content_dir = os.path.join('plone', 'example', 'content')
    >>> interfaces_dir = os.path.join('plone', 'example', 'interfaces')
    
Check for the file::

    >>> ls(content_dir)
    __init__.py
    configure.zcml
    exampletype.py

Check to see that atschema is available::

    >>> paster('addcontent --list')
    paster addcontent --list
    ...
      atschema:     A handy AT schema builder
    ...
    <BLANKLINE>
    
Now add a schema field via paster::

    >>> paster('addcontent atschema --no-interactive')
    paster addcontent atschema --no-interactive
    ...
	
Check that the schema and was inserted and that related imports were inserted::

    >>> cat(os.path.join(content_dir, 'exampletype.py'))
    """Definition of the Example Type content type
    """
    ...
    from plone.example import exampleMessageFactory as _
    ... 
        atapi.StringField(...
    ...
    atapi.registerType(ExampleType, PROJECTNAME)
    <BLANKLINE>
    
Check that appropriate imports and a schema field were added to the interface file::

    >>> cat(os.path.join(interfaces_dir, 'exampletype.py'))
    from zope.interface import Interface
    ...
    from zope import schema
    <BLANKLINE>
    from plone.example import exampleMessageFactory as _
    ...
        newfield = schema.TextLine(
    ...
    <BLANKLINE>



