provide separate (reusable) IOptons interface

This commit is contained in:
Helmut Merz 2013-06-22 10:08:29 +02:00
parent 18f794bfe7
commit 29e0fe5e94
3 changed files with 19 additions and 20 deletions

View file

@ -690,9 +690,21 @@ class IIndexAttributes(Interface):
"""
# reusable interface elements
class IOptions(Interface):
options = schema.List(
title=_(u'Options'),
description=_(u'Additional settings.'),
value_type=schema.TextLine(),
default=[],
required=False)
# types stuff
class ITypeConcept(IConceptSchema, ILoopsAdapter):
class ITypeConcept(IConceptSchema, ILoopsAdapter, IOptions):
""" Concepts of type 'type' should be adaptable to this interface.
"""
@ -725,13 +737,6 @@ class ITypeConcept(IConceptSchema, ILoopsAdapter):
default=u'',
required=False)
options = schema.List(
title=_(u'Options'),
description=_(u'Additional settings.'),
value_type=schema.TextLine(),
default=[],
required=False)
# storage = schema.Choice()

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
"""
Query management stuff.
$Id$
"""
from BTrees.IOBTree import IOBTree
@ -33,6 +31,7 @@ from zope.cachedescriptors.property import Lazy
from cybertools.typology.interfaces import IType
from loops.common import AdapterBase
from loops.interfaces import IConcept, IConceptSchema, ILoopsAdapter
from loops.interfaces import IOptions
from loops.security.common import canListObject
from loops.type import TypeInterfaceSourceList
from loops.versioning.util import getVersion
@ -182,7 +181,7 @@ class ConceptQuery(BaseQuery):
# QueryConcept: concept objects that allow querying the database.
class IQueryConcept(IConceptSchema, ILoopsAdapter):
class IQueryConcept(IConceptSchema, ILoopsAdapter, IOptions):
""" The schema for the query type.
"""
@ -194,13 +193,6 @@ class IQueryConcept(IConceptSchema, ILoopsAdapter):
default=u'',
required=False)
options = schema.List(
title=_(u'Options'),
description=_(u'Additional settings.'),
value_type=schema.TextLine(),
default=[],
required=False)
class QueryConcept(AdapterBase):

View file

@ -34,6 +34,7 @@ from cybertools.typology.type import BaseType, TypeManager
from cybertools.typology.interfaces import ITypeManager
from loops.interfaces import ILoopsObject, IConcept, IResource
from loops.interfaces import ITypeConcept
from loops.interfaces import IOptions
from loops.interfaces import IResourceAdapter, IFile, IExternalFile, IImage
from loops.interfaces import ITextDocument, INote
from loops.concept import Concept
@ -272,7 +273,8 @@ class TypeInterfaceSourceList(object):
implements(schema.interfaces.IIterableSource)
typeInterfaces = (ITypeConcept, IFile, IExternalFile, ITextDocument, INote)
typeInterfaces = (ITypeConcept, IFile, IExternalFile, ITextDocument, INote,
IOptions)
def __init__(self, context):
self.context = context