# From customizing roundup with changes for handling # current or new status being None. # Note that None -> anything transition is allowed. Best to use a # status auditor to make current not be none. def checktransition(db, cl, nodeid, newvalues): ''' Check that the desired transition is valid for the "status" property. ''' if not newvalues.has_key('status'): return current = cl.get(nodeid, 'status') if current is None: return # can always move from none to state. new = newvalues['status'] if new == current: return if new is None: ok = [] else: ok = db.status.get(current, 'transitions') if new not in ok: raise ValueError, 'Status not allowed to move from "%s" to "%s"'%( db.status.get(current, 'name'), db.status.get(new, 'name')) def init(db): db.issue.audit('set', checktransition)