diff --git a/browser/task.py b/browser/concept.py
similarity index 100%
rename from browser/task.py
rename to browser/concept.py
diff --git a/browser/configureFive.zcml b/browser/configureFive.zcml
deleted file mode 100644
index cc85c29..0000000
--- a/browser/configureFive.zcml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/browser/subtasks_assign.pt b/browser/subtasks_assign.pt
index 08e8941..a596433 100644
--- a/browser/subtasks_assign.pt
+++ b/browser/subtasks_assign.pt
@@ -12,7 +12,9 @@
Subtasks:
- subtask
+ **deleted**
+ subtask
-
diff --git a/browser/task_details.pt b/browser/task_details.pt
index b7c5ea3..8a67eb8 100644
--- a/browser/task_details.pt
+++ b/browser/task_details.pt
@@ -12,7 +12,9 @@
Subtasks:
- subtask
+ **deleted**
+ subtask
-
diff --git a/resource.py b/resource.py
deleted file mode 100644
index 9cf6910..0000000
--- a/resource.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# Copyright (c) 2004 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
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-
-"""
-Definition of the Resource class.
-
-$Id$
-"""
-
-from zope.interface import implements
-from zope.app.container.ordered import OrderedContainer
-from zope.app import zapi
-
-from interfaces import IResource
-
-
-class Resource(OrderedContainer):
-
- implements(IResource)
-
- title = u''
-
-
- def __init__(self):
- OrderedContainer.__init__(self)
- self._allocations = {}
-
-
- def getTasksAllocatedTo(self, allocTypes=None, taskTypes=None):
- from sets import Set
- allocs = self._allocations
- res = Set()
- for at in allocs.keys():
- if allocTypes is None or at in allocTypes:
- res.union_update(allocs[at])
- return tuple(res)
-
-
- # Helper methods:
-
- def _addAllocation(self, task, allocType):
- #called by Task.allocateResource
- tList = self._allocations.get(allocType, [])
- tList.append(task)
- self._allocations[allocType] = tList
-
- def _removeAllocations(self, task, allocTypes):
- #called by Task.deallocateResource
- allocs = self._allocations
- for at in allocTypes or allocs.keys():
- if task in allocs[at]:
- allocs[at].remove(task)
-
- def _createResourceName(self, container=None):
- prefix = 'rsc'
- container = container or zapi.getParent(self)
- last = max([ int(n[len(prefix):]) for n in container.keys() ] or [0])
- return prefix + str(last+1)
-
-
diff --git a/test_resource.py b/test_resource.py
deleted file mode 100755
index 929fcae..0000000
--- a/test_resource.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# $Id$
-
-import unittest
-#from zope.testing.doctestunit import DocTestSuite
-from zope.interface.verify import verifyClass
-#from zope.app.tests.setup import placelessSetUp
-#from zope.app.container.tests.test_icontainer import TestSampleContainer
-from zope.app.container.interfaces import IContained
-from zope.app.folder import Folder
-
-from loops.resource import Resource
-from loops.task import Task
-from loops.interfaces import IResource
-
-#class Test(TestSampleContainer):
-class Test(unittest.TestCase):
- "Test methods of the Resource class."
-
- def setUp(self):
- #placelessSetUp()
- self.f1 = Folder()
- self.f1.__name__ = u'f1'
- self.r1 = Resource()
- self.f1['rsc1'] = self.r1
- self.t1 = Task()
- self.f1['tsk1'] = self.t1
-
- def tearDown(self):
- pass
-
- # the tests...
-
- def testInterface(self):
- self.assert_(IResource.providedBy(Resource()),
- 'Interface IResource is not implemented by class Resource.')
- self.assert_(IContained.providedBy(Resource()),
- 'Interface IContained is not implemented by class Resource.')
- verifyClass(IResource, Resource)
-
- def testContained(self):
- self.assertEqual(u'rsc1', self.r1.__name__)
- self.assertEqual(u'f1', self.r1.__parent__.__name__)
-
- def testTitle(self):
- r = Resource()
- self.assertEqual(u'', r.title)
- r.title = u'First Resource'
- self.assertEqual(u'First Resource', r.title)
-
- def testAllocateToTask(self):
- t1 = self.t1
- r1 = self.r1
- self.assertEqual((), r1.getTasksAllocatedTo())
- t1.allocateResource(r1)
- self.assertEqual((t1,), r1.getTasksAllocatedTo())
-
- def testDeallocateFromTask(self):
- t1 = self.t1
- r1 = self.r1
- t1.allocateResource(r1)
- self.assertEqual((t1,), r1.getTasksAllocatedTo())
- t1.deallocateResource(r1)
- self.assertEqual((), r1.getTasksAllocatedTo())
-
-
-def test_suite():
- return unittest.TestSuite((
-# DocTestSuite('loops.tests.doctests'),
- unittest.makeSuite(Test),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
diff --git a/test_task.py b/test_task.py
deleted file mode 100755
index a9b7052..0000000
--- a/test_task.py
+++ /dev/null
@@ -1,239 +0,0 @@
-# $Id$
-
-import unittest
-from zope.testing.doctestunit import DocTestSuite
-from zope.interface.verify import verifyClass
-#from zope.app.tests.setup import placelessSetUp
-from zope.app.testing.setup import placefulSetUp
-#from zope.app.container.tests.test_icontainer import TestSampleContainer
-from zope.app.container.interfaces import IContained
-from zope.app.folder import Folder
-from zope.app import zapi
-
-from loops.task import Task
-from loops.interfaces import ITask
-
-#class Test(TestSampleContainer):
-class TestTask(unittest.TestCase):
- "Test methods of the Task class."
-
- def setUp(self):
-# placelessSetUp()
- placefulSetUp()
- self.f1 = Folder()
- self.f1.__name__ = u'f1'
- self.t1 = Task()
- self.f1['tsk1'] = self.t1
-
- def tearDown(self):
- pass
-
- # the tests...
-
- def testQualifier(self):
- t = Task()
- self.assertEqual(u'', t.qualifier)
- t.qualifier = u'troubleticket'
- self.assertEqual(u'troubleticket', t.qualifier)
-
- def testSubtasks(self):
- t1 = Task()
- self.assertEqual((), t1.getSubtasks())
- t2 = Task()
- self.assertEqual((), t2.getSubtasks())
- self.assertEqual((), t2.getParentTasks())
- t1.assignSubtask(t2)
- self.assertEqual((t2,), t1.getSubtasks())
- self.assertEqual((t1,), t2.getParentTasks())
-
- def testCreateSubtask(self):
- t1 = self.t1
- self.assertEqual((), t1.getSubtasks())
- t2 = t1.createSubtask()
- self.assertEqual((t1,), t2.getParentTasks())
- self.assertEqual((t2,), t1.getSubtasks())
-
- def testDeassignSubtask(self):
- t1 = self.t1
- t2 = t1.createSubtask()
- self.assertEqual((t1,), t2.getParentTasks())
- t1.deassignSubtask(t2)
- self.assertEqual((), t2.getParentTasks())
- self.assertEqual((), t1.getSubtasks())
-
- def testSubtasksOrdering(self):
- t1 = self.t1
- st1 = t1.createSubtask()
- st2 = t1.createSubtask()
- st2.priority = 2
- self.assertEqual((st1, st2), t1.getSubtasks())
- st1.priority = 3
- self.assertEqual((st2, st1), t1.getSubtasks())
-
-
-from loops.resource import Resource
-
-class TestTaskResource(unittest.TestCase):
- "Test methods of the Task class related to Resource allocations."
-
- def setUp(self):
- #placelessSetUp()
- #placefulSetUp()
- self.f1 = Folder()
- self.f1.__name__ = u'f1'
- self.t1 = Task()
- self.r1 = Resource()
- self.f1['tsk1'] = self.t1
- self.f1['rsc1'] = self.r1
-
- def tearDown(self):
- pass
-
- # the tests...
-
- def testAllocateResource(self):
- t1 = self.t1
- r1 = self.r1
- self.assertEqual((), t1.getAllocatedResources())
- t1.allocateResource(r1)
- self.assertEqual((r1,), t1.getAllocatedResources())
-
- def testDeallocateResource(self):
- t1 = self.t1
- r1 = self.r1
- t1.allocateResource(r1)
- self.assertEqual((r1,), t1.getAllocatedResources())
- t1.deallocateResource(r1)
- self.assertEqual((), t1.getAllocatedResources())
-
- def testCreateAndAllocateResource(self):
- t1 = self.t1
- self.assertEqual((), t1.getAllocatedResources())
- r1 = t1.createAndAllocateResource()
- self.assertEqual((r1,), t1.getAllocatedResources())
-
-
-from loops.constraint import ResourceConstraint
-
-class TestTaskResourceConstraints(unittest.TestCase):
- "Test methods of the Task class related to checking for allowed resources."
-
- def setUp(self):
- self.f1 = Folder()
- self.f1.__name__ = u'f1'
- self.t1 = Task()
- self.r1 = Resource()
- self.f1['tsk1'] = self.t1
- self.r1['rsc1'] = self.r1
- self.rc1 = ResourceConstraint()
-
- def tearDown(self):
- pass
-
-
- # the tests...
-
- def testRequireExplicit(self):
- t1 = self.t1
- r1 = self.r1
- rc1 = self.rc1
-
- self.assertEqual(True, t1.isResourceAllowed(r1)) # no check
- self.assertEqual((), t1.getCandidateResources()) # no candidates
- self.assertEqual(None, t1.getAllowedResources([r1]))# can't say without constraint
-
- self.t1.resourceConstraints.append(self.rc1) # empty constraint
- self.assertEqual(False, t1.isResourceAllowed(r1)) # does not allow
- self.assertEqual((), t1.getCandidateResources()) # anything
- self.assertEqual((), t1.getAllowedResources([r1]))
-
- rc1.referenceValues = ([r1])
- self.assertEqual(True, t1.isResourceAllowed(r1))
- self.assertEqual((r1,), t1.getCandidateResources())
- self.assertEqual((r1,), t1.getAllowedResources([r1]))
-
- def testRCCombination(self):
- t1 = self.t1
- r1 = self.r1
- r2 = Resource()
- self.f1['rsc2'] = r2
- rc1 = self.rc1
- rc1.referenceValues = [r1, r2] # allow/select both resources
- rc2 = ResourceConstraint()
- rc2.referenceType = 'checkmethod'
- rc2.referenceKey = 'isAllowedForTesting'
- Resource.isAllowedForTesting = lambda self: zapi.name(self) == 'rsc1'
- t1.resourceConstraints = [rc1, rc2]
- self.assertEqual((r1,), t1.getAllowedResources())
-
- def testIsValid(self):
- t1 = self.t1
- r1 = self.r1
- rc1 = self.rc1
- t1.allocateResource(r1)
- self.failUnless(t1.isValid()) # no constraint - everything valid
- self.t1.resourceConstraints.append(rc1) # empty constraint
- self.failIf(t1.isValid()) # does not allow anything
- rc1.referenceValues = [r1] # explicit allow
- self.failUnless(t1.isValid()) #
-
- def testIsValidParentTask(self):
- t1 = self.t1
- r1 = self.r1
- rc1 = self.rc1
- t1.allocateResource(r1)
- pt = Task()
- pt.assignSubtask(t1)
- self.failUnless(pt.isValid()) # no constraint - everything valid
- self.t1.resourceConstraints.append(rc1) # empty constraint
- self.failIf(pt.isValid()) # does not allow anything
- self.failUnless(pt.isValid(False)) # don't check subtasks
-
-
-class TestTaskCopy(unittest.TestCase):
- "Tests related to copying tasks e.g. when using task prototypes."
-
- def setUp(self):
- self.f1 = Folder()
- self.f1.__name__ = u'f1'
- self.t1 = Task()
- self.r1 = Resource()
- self.f1['tsk1'] = self.t1
- self.f1['rsc1'] = self.r1
- self.rc1 = ResourceConstraint()
-
- def tearDown(self):
- pass
-
-
- # the tests...
-
- def testCopyTask(self):
- t1 = self.t1
- r1 = self.r1
- rc1 = self.rc1
- ts1 = t1.createSubtask()
- ts1.resourceConstraints.append(rc1)
- ts1.allocateResource(r1)
- t2 = t1.copyTask()
- self.failIf(t1 is t2, 't1 and t2 are still the same')
- self.assertEquals(1, len(t1.getSubtasks()))
- st2 = t2.getSubtasks()
- self.assertEquals(1, len(st2))
- ts2 = st2[0]
- self.failIf(ts1 is ts2, 'ts1 and ts2 are still the same')
- self.assertEquals((r1,), ts2.getAllocatedResources())
- self.assertEquals([rc1,], ts2.resourceConstraints)
-
-
-def test_suite():
- return unittest.TestSuite((
- DocTestSuite('loops.tests.doctests'),
- unittest.makeSuite(TestTask),
- unittest.makeSuite(TestTaskResource),
- unittest.makeSuite(TestTaskResourceConstraints),
- unittest.makeSuite(TestTaskCopy),
- ))
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')