work in progress: task indexing: add index for start date, include work item texts in text index entry
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3342 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
49cca0954f
commit
1cb8894abc
3 changed files with 29 additions and 5 deletions
|
@ -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
|
# 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
|
# 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$
|
$Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from time import mktime
|
||||||
|
from zope.component import adapts
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
|
||||||
from loops.organize.interfaces import ITask
|
from loops.organize.interfaces import ITask
|
||||||
from loops.interfaces import IConcept
|
from loops.interfaces import IConcept
|
||||||
|
from loops.interfaces import IIndexAttributes
|
||||||
from loops.common import AdapterBase
|
from loops.common import AdapterBase
|
||||||
from loops.type import TypeInterfaceSourceList
|
from loops.type import TypeInterfaceSourceList
|
||||||
|
|
||||||
|
@ -40,5 +43,23 @@ class Task(AdapterBase):
|
||||||
implements(ITask)
|
implements(ITask)
|
||||||
|
|
||||||
_adapterAttributes = ('context', '__parent__',)
|
_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))
|
||||||
|
|
||||||
|
|
|
@ -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
|
# 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
|
# 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)
|
pau = component.getUtility(IAuthentication, context=context)
|
||||||
if not IPluggableAuthentication.providedBy(pau):
|
if not IPluggableAuthentication.providedBy(pau):
|
||||||
raise ValueError(u'There is no pluggable authentication '
|
raise ValueError(u'There is no pluggable authentication '
|
||||||
'utility available.')
|
u'utility available.')
|
||||||
if not id.startswith(pau.prefix):
|
if not id.startswith(pau.prefix):
|
||||||
next = queryNextUtility(pau, IAuthentication)
|
next = queryNextUtility(pau, IAuthentication)
|
||||||
if next is None:
|
if next is None:
|
||||||
|
|
|
@ -26,8 +26,10 @@ from datetime import date
|
||||||
import time
|
import time
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
|
from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
|
||||||
from zope.cachedescriptors.property import Lazy
|
|
||||||
from zope.app.pagetemplate import ViewPageTemplateFile
|
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.browser import absoluteURL
|
||||||
from zope.traversing.api import getName
|
from zope.traversing.api import getName
|
||||||
|
|
||||||
|
@ -395,6 +397,7 @@ class CreateWorkItem(EditObject, BaseTrackView):
|
||||||
else:
|
else:
|
||||||
wi = workItems.add(util.getUidForObject(self.object), self.personId)
|
wi = workItems.add(util.getUidForObject(self.object), self.personId)
|
||||||
wi.doAction(action, self.personId, **data)
|
wi.doAction(action, self.personId, **data)
|
||||||
|
#notify(ObjectModifiedEvent(obj))
|
||||||
url = self.view.virtualTargetUrl
|
url = self.view.virtualTargetUrl
|
||||||
#url = self.request.URL
|
#url = self.request.URL
|
||||||
self.request.response.redirect(url)
|
self.request.response.redirect(url)
|
||||||
|
|
Loading…
Add table
Reference in a new issue