Minor improvements

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@125 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2004-10-01 14:37:00 +00:00
parent 6d91ae183d
commit 3e4f65cac3
2 changed files with 8 additions and 5 deletions

View file

@ -193,8 +193,11 @@ class ITask(IOrderedContainer):
# resource constraint stuff: # resource constraint stuff:
def isResourceAllowed(resource): def isResourceAllowed(resource, rcDontCheck=None):
""" Return True if the resource given is allowed for this task. """ Return True if the resource given is allowed for this task.
If rcDontChedk is given this resource constraint will be skipped
during checking.
""" """
def getCandidateResources(): def getCandidateResources():

View file

@ -175,7 +175,7 @@ class TestTaskResourceConstraints(unittest.TestCase):
r2 = Resource() r2 = Resource()
self.f1['rsc2'] = r2 self.f1['rsc2'] = r2
rc1 = self.rc1 rc1 = self.rc1
rc1.referenceValues = ([r1, r2]) # allow/select both resources rc1.referenceValues = [r1, r2] # allow/select both resources
rc2 = ResourceConstraint() rc2 = ResourceConstraint()
rc2.referenceType = 'checkmethod' rc2.referenceType = 'checkmethod'
rc2.referenceKey = 'isAllowedForTesting' rc2.referenceKey = 'isAllowedForTesting'
@ -189,9 +189,9 @@ class TestTaskResourceConstraints(unittest.TestCase):
rc1 = self.rc1 rc1 = self.rc1
t1.allocateResource(r1) t1.allocateResource(r1)
self.failUnless(t1.isValid()) # no constraint - everything valid self.failUnless(t1.isValid()) # no constraint - everything valid
self.t1.resourceConstraints.append(self.rc1) # empty constraint self.t1.resourceConstraints.append(rc1) # empty constraint
self.failIf(t1.isValid()) # does not allow anything self.failIf(t1.isValid()) # does not allow anything
rc1.referenceValues = ([r1]) # explicit allow rc1.referenceValues = [r1] # explicit allow
self.failUnless(t1.isValid()) # self.failUnless(t1.isValid()) #
def testIsValidParentTask(self): def testIsValidParentTask(self):
@ -202,7 +202,7 @@ class TestTaskResourceConstraints(unittest.TestCase):
pt = Task() pt = Task()
pt.assignSubtask(t1) pt.assignSubtask(t1)
self.failUnless(pt.isValid()) # no constraint - everything valid self.failUnless(pt.isValid()) # no constraint - everything valid
self.t1.resourceConstraints.append(self.rc1) # empty constraint self.t1.resourceConstraints.append(rc1) # empty constraint
self.failIf(pt.isValid()) # does not allow anything self.failIf(pt.isValid()) # does not allow anything
self.failUnless(pt.isValid(False)) # don't check subtasks self.failUnless(pt.isValid(False)) # don't check subtasks