comparison doc/customizing.txt @ 3259:f3e82dc57c7e maint-0.8

merge from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Tue, 05 Apr 2005 01:13:00 +0000
parents 09fbb09bddd4
children 62d58c72621b
comparison
equal deleted inserted replaced
3257:3654a806e084 3259:f3e82dc57c7e
1 =================== 1 ===================
2 Customising Roundup 2 Customising Roundup
3 =================== 3 ===================
4 4
5 :Version: $Revision: 1.161.2.10 $ 5 :Version: $Revision: 1.161.2.11 $
6 6
7 .. This document borrows from the ZopeBook section on ZPT. The original is at: 7 .. This document borrows from the ZopeBook section on ZPT. The original is at:
8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
9 9
10 .. contents:: 10 .. contents::
3687 - issues may not be resolved if they have blockers 3687 - issues may not be resolved if they have blockers
3688 - when a blocker is resolved, it's removed from issues it blocks 3688 - when a blocker is resolved, it's removed from issues it blocks
3689 3689
3690 The contents of the detector should be something like this:: 3690 The contents of the detector should be something like this::
3691 3691
3692
3692 def blockresolution(db, cl, nodeid, newvalues): 3693 def blockresolution(db, cl, nodeid, newvalues):
3693 ''' If the issue has blockers, don't allow it to be resolved. 3694 ''' If the issue has blockers, don't allow it to be resolved.
3694 ''' 3695 '''
3695 if nodeid is None: 3696 if nodeid is None:
3696 blockers = [] 3697 blockers = []
3717 3718
3718 # ok, see if we're trying to resolve 3719 # ok, see if we're trying to resolve
3719 if newvalues['status'] == resolved_id: 3720 if newvalues['status'] == resolved_id:
3720 raise ValueError, "This issue can't be resolved until %s resolved."%s 3721 raise ValueError, "This issue can't be resolved until %s resolved."%s
3721 3722
3722 def resolveblockers(db, cl, nodeid, newvalues): 3723
3724 def resolveblockers(db, cl, nodeid, oldvalues):
3723 ''' When we resolve an issue that's a blocker, remove it from the 3725 ''' When we resolve an issue that's a blocker, remove it from the
3724 blockers list of the issue(s) it blocks. 3726 blockers list of the issue(s) it blocks.
3725 ''' 3727 '''
3726 if not newvalues.has_key('status'): 3728 newstatus = cl.get(nodeid,'status')
3729
3730 # no change?
3731 if oldvalues.get('status', None) == newstatus:
3727 return 3732 return
3728 3733
3729 # get the resolved state ID
3730 resolved_id = db.status.lookup('resolved') 3734 resolved_id = db.status.lookup('resolved')
3731 3735
3732 # interesting? 3736 # interesting?
3733 if newvalues['status'] != resolved_id: 3737 if newstatus != resolved_id:
3734 return 3738 return
3735 3739
3736 # yes - find all the blocked issues, if any, and remove me from 3740 # yes - find all the blocked issues, if any, and remove me from
3737 # their blockers list 3741 # their blockers list
3738 issues = cl.find(blockers=nodeid) 3742 issues = cl.find(blockers=nodeid)
3739 for issueid in issues: 3743 for issueid in issues:
3740 blockers = cl.get(issueid, 'blockers') 3744 blockers = cl.get(issueid, 'blockers')
3741 if nodeid in blockers: 3745 if nodeid in blockers:
3742 blockers.remove(nodeid) 3746 blockers.remove(nodeid)
3743 cl.set(issueid, blockers=blockers) 3747 cl.set(issueid, blockers=blockers)
3744
3745 3748
3746 def init(db): 3749 def init(db):
3747 # might, in an obscure situation, happen in a create 3750 # might, in an obscure situation, happen in a create
3748 db.issue.audit('create', blockresolution) 3751 db.issue.audit('create', blockresolution)
3749 db.issue.audit('set', blockresolution) 3752 db.issue.audit('set', blockresolution)

Roundup Issue Tracker: http://roundup-tracker.org/