provide predicateInterface field for IPredicate; set up example 'IAllocated'

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2782 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-07-31 07:21:35 +00:00
parent 543a2e4127
commit f165e4b1e8
7 changed files with 47 additions and 11 deletions

View file

@ -406,6 +406,11 @@
component="loops.type.TypeInterfaceSourceList" component="loops.type.TypeInterfaceSourceList"
name="loops.TypeInterfaceSource" /> name="loops.TypeInterfaceSource" />
<utility
provides="zope.schema.interfaces.IVocabularyFactory"
component="loops.predicate.PredicateInterfaceSourceList"
name="loops.PredicateInterfaceSource" />
<include package=".browser" /> <include package=".browser" />
<include package=".classifier" /> <include package=".classifier" />

View file

@ -620,7 +620,7 @@ class ITypeConcept(IConceptSchema):
description=_(u'An interface that objects of this type can ' description=_(u'An interface that objects of this type can '
'be adapted to'), 'be adapted to'),
default=None, default=None,
source="loops.TypeInterfaceSource", source='loops.TypeInterfaceSource',
required=False) required=False)
viewName = schema.TextLine( viewName = schema.TextLine(
@ -645,13 +645,13 @@ class IPredicate(IConceptSchema):
i.e. concepts of type 'predicate' should be adaptable to this interface. i.e. concepts of type 'predicate' should be adaptable to this interface.
""" """
typeInterface = schema.TextLine( #schema.Choice predicateInterface = schema.Choice(
title=_(u'Type Interface'), title=_(u'Predicate Interface'),
description=_(u'Optional: allows specification of additional ' description=_(u'Optional: allows specification of additional '
'attributes of relations that are instances of this ' 'attributes of relations that are instances of this '
'predicate.'), 'predicate.'),
default=u'', #None default=None,
#source="loops.TypeInterfaceSource", source='loops.PredicateInterfaceSource',
required=False) required=False)

View file

@ -355,6 +355,16 @@ Events listing
>>> list(listing.events()) >>> list(listing.events())
[<loops.browser.concept.ConceptRelationView ...>] [<loops.browser.concept.ConceptRelationView ...>]
Allocation of persons to tasks
------------------------------
>>> from loops.organize.interfaces import IAllocated
>>> predicate = concepts['predicate']
>>> allocated = addAndConfigureObject(concepts, Concept, 'allocated',
... title=u'allocated',
... conceptType=predicate, predicateInterface=IAllocated)
Fin de partie Fin de partie
============= =============

View file

@ -34,6 +34,7 @@ from cybertools.organize.interfaces import IPerson as IBasePerson
from cybertools.organize.interfaces import ITask from cybertools.organize.interfaces import ITask
from loops.interfaces import IConceptSchema from loops.interfaces import IConceptSchema
from loops.organize.util import getPrincipalFolder from loops.organize.util import getPrincipalFolder
from loops import util
from loops.util import _ from loops.util import _
ANNOTATION_KEY = 'loops.organize.person' ANNOTATION_KEY = 'loops.organize.person'
@ -141,7 +142,7 @@ class IMemberRegistrationManager(Interface):
""" """
authPluginId = Attribute(u'The id of an authentication plugin to be ' authPluginId = Attribute(u'The id of an authentication plugin to be '
'used for managing members of this loops site') u'used for managing members of this loops site')
def register(userId, password, lastName, firstName=u'', **kw): def register(userId, password, lastName, firstName=u'', **kw):
""" Register a new member for this loops site. """ Register a new member for this loops site.
@ -161,3 +162,18 @@ class ITask(IConceptSchema, ITask):
pass pass
# 'allocated' predicate
class IAllocated(Interface):
allocType = schema.Choice(
title=_(u'Allocation Type'),
description=_(u'Specifies the kind of interaction a person or another '
u'party has with the task or project it is allocated to.'),
source=util.KeywordVocabulary((
('standard', _(u'Standard')),
('master', _(u'Master')),
)),
default='standard',
required=True)

View file

@ -40,16 +40,18 @@ from cybertools.typology.interfaces import IType
from loops.common import AdapterBase from loops.common import AdapterBase
from loops.concept import Concept from loops.concept import Concept
from loops.interfaces import IConcept from loops.interfaces import IConcept
from loops.organize.interfaces import IAddress from loops.organize.interfaces import IAddress, IPerson, IAllocated
from loops.organize.interfaces import IPerson, ANNOTATION_KEY from loops.organize.interfaces import ANNOTATION_KEY
from loops.security.common import assignOwner, removeOwner, allowEditingForOwner from loops.security.common import assignOwner, removeOwner, allowEditingForOwner
from loops.type import TypeInterfaceSourceList from loops.type import TypeInterfaceSourceList
from loops.predicate import PredicateInterfaceSourceList
from loops import util from loops import util
# register type interfaces - (TODO: use a function for this) # register type interfaces - (TODO: use a function for this)
TypeInterfaceSourceList.typeInterfaces += (IPerson, IAddress) TypeInterfaceSourceList.typeInterfaces += (IPerson, IAddress)
PredicateInterfaceSourceList.typeInterfaces += (IAllocated,)
def getPersonForUser(context, request=None, principal=None): def getPersonForUser(context, request=None, principal=None):

View file

@ -46,6 +46,9 @@ class SetupManager(BaseSetupManager):
owner = self.addObject(concepts, Concept, 'ownedby', title=u'owned by', owner = self.addObject(concepts, Concept, 'ownedby', title=u'owned by',
conceptType=predicate) conceptType=predicate)
#allocated = self.addAndConfigureObject(concepts, Concept, 'allocated',
# title=u'allocated',
# conceptType=predicate, predicateInterface=IAllocated)
task = self.addAndConfigureObject(concepts, Concept, 'task', title=u'Task', task = self.addAndConfigureObject(concepts, Concept, 'task', title=u'Task',
conceptType=type, typeInterface=ITask) conceptType=type, typeInterface=ITask)

View file

@ -34,10 +34,10 @@ from loops.interfaces import ILoopsObject, IConcept, IResource
from loops.interfaces import IPredicate from loops.interfaces import IPredicate
from loops.concept import Concept from loops.concept import Concept
from loops.common import AdapterBase from loops.common import AdapterBase
from loops.type import TypeInterfaceSourceList as BaseTypeInterfaceSourceList from loops.type import TypeInterfaceSourceList
BaseTypeInterfaceSourceList.typeInterfaces += (IPredicate,) TypeInterfaceSourceList.typeInterfaces += (IPredicate,)
class Predicate(AdapterBase): class Predicate(AdapterBase):
@ -49,7 +49,7 @@ class Predicate(AdapterBase):
_contextAttributes = list(IPredicate) + list(IConcept) _contextAttributes = list(IPredicate) + list(IConcept)
class TypeInterfaceSourceList(BaseTypeInterfaceSourceList): class PredicateInterfaceSourceList(TypeInterfaceSourceList):
""" Collects type interfaces for predicates, i.e. interfaces that """ Collects type interfaces for predicates, i.e. interfaces that
may be used for specifying additional attributes of relations. may be used for specifying additional attributes of relations.
""" """