comparison doc/design.txt @ 1519:6fede2aa6a12

added ability to restore retired nodes
author Andrey Lebedev <kedder@users.sourceforge.net>
date Sun, 16 Mar 2003 22:24:56 +0000
parents 8dd4f736370b
children f5d53a939b67
comparison
equal deleted inserted replaced
1518:bb843662b708 1519:6fede2aa6a12
306 database over the network, etc. 306 database over the network, etc.
307 307
308 The 'journaltag' is a token that will be attached to the journal 308 The 'journaltag' is a token that will be attached to the journal
309 entries for any edits done on the database. If 'journaltag' is 309 entries for any edits done on the database. If 'journaltag' is
310 None, the database is opened in read-only mode: the Class.create(), 310 None, the database is opened in read-only mode: the Class.create(),
311 Class.set(), and Class.retire() methods are disabled. 311 Class.set(), Class.retire(), and Class.restore() methods are
312 disabled.
312 """ 313 """
313 314
314 def __getattr__(self, classname): 315 def __getattr__(self, classname):
315 """A convenient way of calling self.getclass(classname).""" 316 """A convenient way of calling self.getclass(classname)."""
316 317
376 The properties on the item remain available from the get() method, 377 The properties on the item remain available from the get() method,
377 and the item's id is never reused. Retired items are not returned 378 and the item's id is never reused. Retired items are not returned
378 by the find(), list(), or lookup() methods, and other items may 379 by the find(), list(), or lookup() methods, and other items may
379 reuse the values of their key properties. 380 reuse the values of their key properties.
380 """ 381 """
382
383 def restore(self, nodeid):
384 '''Restpre a retired node.
385
386 Make node available for all operations like it was before retirement.
387 '''
381 388
382 def history(self, itemid): 389 def history(self, itemid):
383 """Retrieve the journal of edits on a particular item. 390 """Retrieve the journal of edits on a particular item.
384 391
385 'itemid' must be the id of an existing item of this class or an 392 'itemid' must be the id of an existing item of this class or an
791 798
792 1. an auditor is triggered just before modifying an item 799 1. an auditor is triggered just before modifying an item
793 2. a reactor is triggered just after an item has been modified 800 2. a reactor is triggered just after an item has been modified
794 801
795 When the Roundup database is about to perform a 802 When the Roundup database is about to perform a
796 ``create()``, ``set()``, or ``retire()`` 803 ``create()``, ``set()``, ``retire()``, or ``restore``
797 operation, it first calls any *auditors* that 804 operation, it first calls any *auditors* that
798 have been registered for that operation on that class. 805 have been registered for that operation on that class.
799 Any auditor may raise a *Reject* exception 806 Any auditor may raise a *Reject* exception
800 to abort the operation. 807 to abort the operation.
801 808
812 819
813 class Class: 820 class Class:
814 def audit(self, event, detector): 821 def audit(self, event, detector):
815 """Register an auditor on this class. 822 """Register an auditor on this class.
816 823
817 'event' should be one of "create", "set", or "retire". 824 'event' should be one of "create", "set", "retire", or "restore".
818 'detector' should be a function accepting four arguments. 825 'detector' should be a function accepting four arguments.
819 """ 826 """
820 827
821 def react(self, event, detector): 828 def react(self, event, detector):
822 """Register a reactor on this class. 829 """Register a reactor on this class.
823 830
824 'event' should be one of "create", "set", or "retire". 831 'event' should be one of "create", "set", "retire", or "restore".
825 'detector' should be a function accepting four arguments. 832 'detector' should be a function accepting four arguments.
826 """ 833 """
827 834
828 Auditors are called with the arguments:: 835 Auditors are called with the arguments::
829 836
840 847
841 For a ``set()`` operation, newdata 848 For a ``set()`` operation, newdata
842 contains only the names and values of properties that are about 849 contains only the names and values of properties that are about
843 to be changed. 850 to be changed.
844 851
845 For a ``retire()`` operation, newdata is None. 852 For a ``retire()`` or ``restore()`` operation, newdata is None.
846 853
847 Reactors are called with the arguments:: 854 Reactors are called with the arguments::
848 855
849 react(db, cl, itemid, olddata) 856 react(db, cl, itemid, olddata)
850 857
857 newly-created item and ``olddata`` is None. 864 newly-created item and ``olddata`` is None.
858 865
859 For a ``set()`` operation, ``olddata`` 866 For a ``set()`` operation, ``olddata``
860 contains the names and previous values of properties that were changed. 867 contains the names and previous values of properties that were changed.
861 868
862 For a ``retire()`` operation, ``itemid`` is the 869 For a ``retire()`` or ``restore()`` operation, ``itemid`` is the id of
863 id of the retired item and ``olddata`` is None. 870 the retired or restored item and ``olddata`` is None.
864 871
865 Detector Example 872 Detector Example
866 ~~~~~~~~~~~~~~~~ 873 ~~~~~~~~~~~~~~~~
867 874
868 Here is an example of detectors written for a hypothetical 875 Here is an example of detectors written for a hypothetical

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