diff --git a/__init__.py b/__init__.py index d6ec769..4bc90fb 100644 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,4 @@ """ -$Id: __init__.py $ +$Id$ """ diff --git a/browser/configure.zcml b/browser/configure.zcml index 55f7f83..cc85c29 100644 --- a/browser/configure.zcml +++ b/browser/configure.zcml @@ -39,13 +39,37 @@ add="zope.ManageContent" /> + + + + + + + + + + diff --git a/browser/subtasks_assign.pt b/browser/subtasks_assign.pt new file mode 100644 index 0000000..08e8941 --- /dev/null +++ b/browser/subtasks_assign.pt @@ -0,0 +1,47 @@ + + + + + +
+ +

Task Title

+ +
+ Subtasks: + + subtask + - + +
+
+ Parent Tasks: + + parent task + - + +
+
+ Last Modified: + 2004-08-28 +
+ +
+
+ Subtasks: + + + +
+
+ +
+
+ +
+ + diff --git a/browser/task.py b/browser/task.py index 6b5ad53..54dffb1 100644 --- a/browser/task.py +++ b/browser/task.py @@ -24,10 +24,11 @@ $Id$ from zope.app import zapi from zope.app.dublincore.interfaces import ICMFDublinCore +from zope.security.proxy import removeSecurityProxy from loops.interfaces import ITask -class TaskDetails: +class Details: def modified(self): """ get date/time of last modification @@ -36,3 +37,16 @@ class TaskDetails: d = dc.modified or dc.created return d and d.strftime('%Y-%m-%d %H:%M') or '' + +class SubtaskAssignments(Details): + + def assignSubtask(self): + """ Add a subtask denoted by the path given in the + request variable subtaskPath. + """ + subtaskPath = self.request.get('subtaskPath') + #if subtaskPath: + subtask = zapi.traverse(zapi.getRoot(self.context), subtaskPath, None, self.request) + #if subtask: + self.context.assignSubtask(removeSecurityProxy(subtask)) + self.request.response.redirect('.') diff --git a/task.py b/task.py index e86e3fa..fe55d1a 100644 --- a/task.py +++ b/task.py @@ -59,8 +59,8 @@ class Task(OrderedContainer): return tuple(self._parentTasks) def assignSubtask(self, task): - self._subtasks.append(task) - task._parentTasks.append(self) + self._subtasks = self._subtasks + [task] + task._parentTasks = task._parentTasks + [self] def createSubtask(self, taskType=None, container=None, name=None): container = container or zapi.getParent(self) diff --git a/tests/__init__.py b/tests/__init__.py index d6ec769..4bc90fb 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,4 +1,4 @@ """ -$Id: __init__.py $ +$Id$ """ diff --git a/tests/test_task.py b/tests/test_task.py index 8cd4f5d..dd9bc9f 100755 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -1,10 +1,10 @@ # $Id$ import unittest -#from zope.testing.doctestunit import DocTestSuite +from zope.testing.doctestunit import DocTestSuite from zope.interface.verify import verifyClass #from zope.app.tests.setup import placelessSetUp -from zope.app.tests.setup import placefulSetUp +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 @@ -244,7 +244,7 @@ class TestTaskCopy(unittest.TestCase): def test_suite(): return unittest.TestSuite(( -# DocTestSuite('loops.tests.doctests'), + DocTestSuite('loops.tests.doctests'), unittest.makeSuite(TestTask), unittest.makeSuite(TestTaskResource), unittest.makeSuite(TestTaskResourceConstraints),