diff --git a/organize/task.py b/organize/task.py index 8f7f470..b069497 100644 --- a/organize/task.py +++ b/organize/task.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2006 Helmut Merz helmutm@cy55.de +# Copyright (c) 2009 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 @@ -22,10 +22,13 @@ Adapters for IConcept providing interfaces from the cybertools.organize package. $Id$ """ +from time import mktime +from zope.component import adapts from zope.interface import implements from loops.organize.interfaces import ITask from loops.interfaces import IConcept +from loops.interfaces import IIndexAttributes from loops.common import AdapterBase from loops.type import TypeInterfaceSourceList @@ -40,5 +43,23 @@ class Task(AdapterBase): implements(ITask) _adapterAttributes = ('context', '__parent__',) - _contextAttributes = list(ITask) # + list(IConcept) + _contextAttributes = list(ITask) + + +class IndexAttributes(object): + + implements(IIndexAttributes) + adapts(ITask) + + def __init__(self, context): + self.context = context + + def text(self): + # TODO: collect text from work items + return ' '.join((self.title, self.description)) + + def date(self): + value = self.context.start + if value: + return int(mktime(value.utctimetuple)) diff --git a/organize/util.py b/organize/util.py index e31f7fc..6cabe26 100644 --- a/organize/util.py +++ b/organize/util.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 Helmut Merz helmutm@cy55.de +# Copyright (c) 2009 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 @@ -64,7 +64,7 @@ def getInternalPrincipal(id, context=None, pau=None): pau = component.getUtility(IAuthentication, context=context) if not IPluggableAuthentication.providedBy(pau): raise ValueError(u'There is no pluggable authentication ' - 'utility available.') + u'utility available.') if not id.startswith(pau.prefix): next = queryNextUtility(pau, IAuthentication) if next is None: diff --git a/organize/work/browser.py b/organize/work/browser.py index 61a89fd..77f9cd2 100644 --- a/organize/work/browser.py +++ b/organize/work/browser.py @@ -26,8 +26,10 @@ from datetime import date import time from zope import component from zope.app.security.interfaces import IAuthentication, PrincipalLookupError -from zope.cachedescriptors.property import Lazy from zope.app.pagetemplate import ViewPageTemplateFile +from zope.cachedescriptors.property import Lazy +from zope.event import notify +from zope.lifecycleevent import ObjectModifiedEvent from zope.traversing.browser import absoluteURL from zope.traversing.api import getName @@ -395,6 +397,7 @@ class CreateWorkItem(EditObject, BaseTrackView): else: wi = workItems.add(util.getUidForObject(self.object), self.personId) wi.doAction(action, self.personId, **data) + #notify(ObjectModifiedEvent(obj)) url = self.view.virtualTargetUrl #url = self.request.URL self.request.response.redirect(url)