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"
name="loops.TypeInterfaceSource" />
<utility
provides="zope.schema.interfaces.IVocabularyFactory"
component="loops.predicate.PredicateInterfaceSourceList"
name="loops.PredicateInterfaceSource" />
<include package=".browser" />
<include package=".classifier" />

View file

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

View file

@ -355,6 +355,16 @@ Events listing
>>> list(listing.events())
[<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
=============

View file

@ -34,6 +34,7 @@ from cybertools.organize.interfaces import IPerson as IBasePerson
from cybertools.organize.interfaces import ITask
from loops.interfaces import IConceptSchema
from loops.organize.util import getPrincipalFolder
from loops import util
from loops.util import _
ANNOTATION_KEY = 'loops.organize.person'
@ -141,7 +142,7 @@ class IMemberRegistrationManager(Interface):
"""
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):
""" Register a new member for this loops site.
@ -161,3 +162,18 @@ class ITask(IConceptSchema, ITask):
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.concept import Concept
from loops.interfaces import IConcept
from loops.organize.interfaces import IAddress
from loops.organize.interfaces import IPerson, ANNOTATION_KEY
from loops.organize.interfaces import IAddress, IPerson, IAllocated
from loops.organize.interfaces import ANNOTATION_KEY
from loops.security.common import assignOwner, removeOwner, allowEditingForOwner
from loops.type import TypeInterfaceSourceList
from loops.predicate import PredicateInterfaceSourceList
from loops import util
# register type interfaces - (TODO: use a function for this)
TypeInterfaceSourceList.typeInterfaces += (IPerson, IAddress)
PredicateInterfaceSourceList.typeInterfaces += (IAllocated,)
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',
conceptType=predicate)
#allocated = self.addAndConfigureObject(concepts, Concept, 'allocated',
# title=u'allocated',
# conceptType=predicate, predicateInterface=IAllocated)
task = self.addAndConfigureObject(concepts, Concept, 'task', title=u'Task',
conceptType=type, typeInterface=ITask)

View file

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