From 29e0fe5e94220d1f4bdf989034cfa9460684e8d4 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 22 Jun 2013 10:08:29 +0200 Subject: [PATCH] provide separate (reusable) IOptons interface --- interfaces.py | 21 +++++++++++++-------- query.py | 14 +++----------- type.py | 4 +++- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/interfaces.py b/interfaces.py index 1330a6a..cc82fde 100644 --- a/interfaces.py +++ b/interfaces.py @@ -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() diff --git a/query.py b/query.py index 1c0ddce..eb6fafb 100644 --- a/query.py +++ b/query.py @@ -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): diff --git a/type.py b/type.py index 4e5f783..d6feec4 100644 --- a/type.py +++ b/type.py @@ -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