diff --git a/composer/schema/field.py b/composer/schema/field.py index a22aabd..f26527b 100644 --- a/composer/schema/field.py +++ b/composer/schema/field.py @@ -25,11 +25,13 @@ $Id$ from zope.interface import implements from zope import schema -from cybertools.composer.base import Component, Element, Compound -from cybertools.composer.base import Template +from cybertools.composer.base import Component +from cybertools.composer.schema.interfaces import IField -class Field(Component, schema.Field): +class Field(Component): + + implements(IField) def __init__(self, name, title=None, renderFactory=None, **kw): assert name diff --git a/composer/schema/interfaces.py b/composer/schema/interfaces.py index 1046ac9..7a1d7ea 100644 --- a/composer/schema/interfaces.py +++ b/composer/schema/interfaces.py @@ -22,6 +22,51 @@ Schemas and Fields. $Id$ """ +from zope import schema from zope.interface import Interface, Attribute +from zope.i18nmessageid import MessageFactory + +from cybertools.composer.interfaces import ITemplate, IComponent + +_ = MessageFactory('zope') +class ISchema(ITemplate): + """ Represents an ordered sequence of fields. + """ + + fields = Attribute('The components the schema is built up of. ' + 'Should be a sequence of IField objects.') + + +class IField(IComponent): + """ May be used for data entry or display. + """ + + name = schema.ASCII( + title=_(u'Fieldname'), + description=_(u'The internal name of the field'), + required=True,) + title = schema.TextLine( + title=_(u'Title'), + description=_(u'The title or label of the field'), + required=True,) + description = schema.Text( + title=_(u'Description'), + description=_(u'A more lengthy description of the field'), + required=False,) + fieldType = schema.Choice( + title=_(u'Field type'), + description=_(u'The type of the field'), + required=True, + default='textline', + values=('textline', 'textarea', 'date')) + defaultValue = schema.TextLine( + title=_(u'Default'), + description=_(u'Value with which to pre-set the field contents'), + required=False,) + required = schema.Bool( + title=_(u'Required'), + description=_(u'Must a value been entered into this field?'), + required=False,) + diff --git a/composer/schema/schema.py b/composer/schema/schema.py index 71ec87f..7526ce4 100644 --- a/composer/schema/schema.py +++ b/composer/schema/schema.py @@ -26,10 +26,13 @@ from zope.interface import implements from cybertools.composer.base import Component, Element, Compound from cybertools.composer.base import Template +from cybertools.composer.schema.interfaces import ISchema class Schema(Template): + implements(ISchema) + def __init__(self, *fields): super(Schema, self).__init__() for f in fields: diff --git a/organize/service.py b/organize/service.py index e929937..0ee99c5 100644 --- a/organize/service.py +++ b/organize/service.py @@ -37,7 +37,7 @@ class Service(object): implements(IService) - def __init__(self, seats=-1): + def __init__(self, capacity=-1): self.capacity = capacity self.registrations = []