comparison doc/customizing.txt @ 3258:1cbde34afa77

fix to doc
author Richard Jones <richard@users.sourceforge.net>
date Tue, 05 Apr 2005 01:06:54 +0000
parents 78d2f3ce85f6
children e41e1540a287
comparison
equal deleted inserted replaced
3256:1a572fffd9a2 3258:1cbde34afa77
1 =================== 1 ===================
2 Customising Roundup 2 Customising Roundup
3 =================== 3 ===================
4 4
5 :Version: $Revision: 1.174 $ 5 :Version: $Revision: 1.175 $
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::
3690 - issues may not be resolved if they have blockers 3690 - issues may not be resolved if they have blockers
3691 - when a blocker is resolved, it's removed from issues it blocks 3691 - when a blocker is resolved, it's removed from issues it blocks
3692 3692
3693 The contents of the detector should be something like this:: 3693 The contents of the detector should be something like this::
3694 3694
3695
3695 def blockresolution(db, cl, nodeid, newvalues): 3696 def blockresolution(db, cl, nodeid, newvalues):
3696 ''' If the issue has blockers, don't allow it to be resolved. 3697 ''' If the issue has blockers, don't allow it to be resolved.
3697 ''' 3698 '''
3698 if nodeid is None: 3699 if nodeid is None:
3699 blockers = [] 3700 blockers = []
3720 3721
3721 # ok, see if we're trying to resolve 3722 # ok, see if we're trying to resolve
3722 if newvalues['status'] == resolved_id: 3723 if newvalues['status'] == resolved_id:
3723 raise ValueError, "This issue can't be resolved until %s resolved."%s 3724 raise ValueError, "This issue can't be resolved until %s resolved."%s
3724 3725
3725 def resolveblockers(db, cl, nodeid, newvalues): 3726
3727 def resolveblockers(db, cl, nodeid, oldvalues):
3726 ''' When we resolve an issue that's a blocker, remove it from the 3728 ''' When we resolve an issue that's a blocker, remove it from the
3727 blockers list of the issue(s) it blocks. 3729 blockers list of the issue(s) it blocks.
3728 ''' 3730 '''
3729 if not newvalues.has_key('status'): 3731 newstatus = cl.get(nodeid,'status')
3732
3733 # no change?
3734 if oldvalues.get('status', None) == newstatus:
3730 return 3735 return
3731 3736
3732 # get the resolved state ID
3733 resolved_id = db.status.lookup('resolved') 3737 resolved_id = db.status.lookup('resolved')
3734 3738
3735 # interesting? 3739 # interesting?
3736 if newvalues['status'] != resolved_id: 3740 if newstatus != resolved_id:
3737 return 3741 return
3738 3742
3739 # yes - find all the blocked issues, if any, and remove me from 3743 # yes - find all the blocked issues, if any, and remove me from
3740 # their blockers list 3744 # their blockers list
3741 issues = cl.find(blockers=nodeid) 3745 issues = cl.find(blockers=nodeid)
3742 for issueid in issues: 3746 for issueid in issues:
3743 blockers = cl.get(issueid, 'blockers') 3747 blockers = cl.get(issueid, 'blockers')
3744 if nodeid in blockers: 3748 if nodeid in blockers:
3745 blockers.remove(nodeid) 3749 blockers.remove(nodeid)
3746 cl.set(issueid, blockers=blockers) 3750 cl.set(issueid, blockers=blockers)
3747
3748 3751
3749 def init(db): 3752 def init(db):
3750 # might, in an obscure situation, happen in a create 3753 # might, in an obscure situation, happen in a create
3751 db.issue.audit('create', blockresolution) 3754 db.issue.audit('create', blockresolution)
3752 db.issue.audit('set', blockresolution) 3755 db.issue.audit('set', blockresolution)

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