comparison doc/design.txt @ 3490:976bd292eaa0

db detectors got priority numbers (rfe [SF#1413165])
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Tue, 24 Jan 2006 08:30:49 +0000
parents 440f0a6a2e3c
children 8ee9b38789af
comparison
equal deleted inserted replaced
3489:87e512f87bae 3490:976bd292eaa0
727 """These operations trigger detectors and can be vetoed. 727 """These operations trigger detectors and can be vetoed.
728 Attempts to modify the "creation", "creator", "activity" 728 Attempts to modify the "creation", "creator", "activity"
729 properties or "actor" cause a KeyError. 729 properties or "actor" cause a KeyError.
730 """ 730 """
731 731
732 # New methods:
733
734 def audit(self, event, detector):
735 def react(self, event, detector):
736 """Register a detector (see below for more details)."""
737
738 class IssueClass(Class): 732 class IssueClass(Class):
739 # Overridden methods: 733 # Overridden methods:
740 734
741 def __init__(self, db, classname, **properties): 735 def __init__(self, db, classname, **properties):
742 """The newly-created class automatically includes the 736 """The newly-created class automatically includes the
853 847
854 The ``audit()`` and ``react()`` methods register detectors on a given 848 The ``audit()`` and ``react()`` methods register detectors on a given
855 class of items:: 849 class of items::
856 850
857 class Class: 851 class Class:
858 def audit(self, event, detector): 852 def audit(self, event, detector, priority=100):
859 """Register an auditor on this class. 853 """Register an auditor on this class.
860 854
861 'event' should be one of "create", "set", "retire", or 855 'event' should be one of "create", "set", "retire", or
862 "restore". 'detector' should be a function accepting four 856 "restore". 'detector' should be a function accepting four
863 arguments. 857 arguments. Detectors are called in priority order, execution
864 """ 858 order is undefined for detectors with the same priority.
865 859 """
866 def react(self, event, detector): 860
861 def react(self, event, detector, priority=100):
867 """Register a reactor on this class. 862 """Register a reactor on this class.
868 863
869 'event' should be one of "create", "set", "retire", or 864 'event' should be one of "create", "set", "retire", or
870 "restore". 'detector' should be a function accepting four 865 "restore". 'detector' should be a function accepting four
871 arguments. 866 arguments. Detectors are called in priority order, execution
867 order is undefined for detectors with the same priority.
872 """ 868 """
873 869
874 Auditors are called with the arguments:: 870 Auditors are called with the arguments::
875 871
876 audit(db, cl, itemid, newdata) 872 audit(db, cl, itemid, newdata)

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