handle deleted tasks gracefully
This commit is contained in:
parent
49b7ef0382
commit
5f81ecfed2
4 changed files with 13 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2014 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
|
||||
|
@ -56,6 +56,8 @@ PredicateInterfaceSourceList.predicateInterfaces += (IHasRole,)
|
|||
|
||||
|
||||
def getPersonForUser(context, request=None, principal=None):
|
||||
if context is None:
|
||||
return None
|
||||
if principal is None:
|
||||
principal = getattr(request, 'principal', None)
|
||||
if principal is None:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2014 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
|
||||
|
@ -264,6 +264,9 @@ class TrackDetails(BaseView):
|
|||
@Lazy
|
||||
def objectData(self):
|
||||
obj = self.object
|
||||
if obj is None:
|
||||
return dict(object=None, title='-', type='-', url='',
|
||||
version=None, canAccess=False)
|
||||
node = self.view.nodeView
|
||||
url = node is not None and node.getUrlForTarget(obj) or ''
|
||||
view = self.view.getViewForObject(obj)
|
||||
|
|
|
@ -170,6 +170,9 @@ class WorkItemDetails(TrackDetails):
|
|||
@Lazy
|
||||
def allowedToEditWorkItem(self):
|
||||
#if checkPermission('loops.ManageSite', self.object):
|
||||
if (self.object is None and
|
||||
checkPermission('zope.ManageContent', self.view.node)):
|
||||
return True
|
||||
if checkPermission('zope.ManageContent', self.object):
|
||||
return True
|
||||
return self.user['object'] == getPersonForUser(self.object, self.view.request)
|
||||
|
|
|
@ -36,8 +36,9 @@
|
|||
<td class="nowrap center" tal:content="row/end">20:00</td>
|
||||
<td class="nowrap center" tal:content="row/duration">2:30</td>
|
||||
<td tal:condition="python: 'Task' in work.columns">
|
||||
<a tal:attributes="href row/objectData/url"
|
||||
tal:content="row/objectData/title">Task</a></td>
|
||||
<a tal:define="data row/objectData"
|
||||
tal:attributes="href data/url"
|
||||
tal:content="data/title">Task</a></td>
|
||||
<td tal:condition="python: 'User' in work.columns">
|
||||
<a tal:attributes="href row/user/url"
|
||||
tal:content="row/user/title">John</a></td>
|
||||
|
|
Loading…
Add table
Reference in a new issue