extend composer.schema and organize.service stuff
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1834 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
e9b8722793
commit
7aad7a6430
4 changed files with 54 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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,)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -37,7 +37,7 @@ class Service(object):
|
|||
|
||||
implements(IService)
|
||||
|
||||
def __init__(self, seats=-1):
|
||||
def __init__(self, capacity=-1):
|
||||
self.capacity = capacity
|
||||
self.registrations = []
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue