Mercurial > p > roundup > code
diff roundup/backends/back_anydbm.py @ 3489:87e512f87bae
common initialization code and detectors interface
moved to hyperdb.py (patch from rfe [SF#413165])
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Tue, 24 Jan 2006 08:27:54 +0000 |
| parents | 34ada15b9936 |
| children | 5cd1c83dea50 |
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py Tue Jan 24 08:22:42 2006 +0000 +++ b/roundup/backends/back_anydbm.py Tue Jan 24 08:27:54 2006 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.193 2006-01-23 05:24:33 richard Exp $ +#$Id: back_anydbm.py,v 1.194 2006-01-24 08:26:09 a1s Exp $ '''This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several @@ -735,32 +735,6 @@ class Class(hyperdb.Class): '''The handle to a particular class of nodes in a hyperdatabase.''' - def __init__(self, db, classname, **properties): - '''Create a new class with a given name and property specification. - - 'classname' must not collide with the name of an existing class, - or a ValueError is raised. The keyword arguments in 'properties' - must map names to property objects, or a TypeError is raised. - ''' - for name in 'creation activity creator actor'.split(): - if properties.has_key(name): - raise ValueError, '"creation", "activity", "creator" and '\ - '"actor" are reserved' - - self.classname = classname - self.properties = properties - self.db = weakref.proxy(db) # use a weak ref to avoid circularity - self.key = '' - - # should we journal changes (default yes) - self.do_journal = 1 - - # do the db-related init stuff - db.addclass(self) - - self.auditors = {'create': [], 'set': [], 'retire': [], 'restore': []} - self.reactors = {'create': [], 'set': [], 'retire': [], 'restore': []} - def enableJournalling(self): '''Turn journalling on for this class ''' @@ -1881,36 +1855,6 @@ continue self.db.indexer.add_text((self.classname, nodeid, prop), value) - - # - # Detector interface - # - def audit(self, event, detector): - '''Register a detector - ''' - l = self.auditors[event] - if detector not in l: - self.auditors[event].append(detector) - - def fireAuditors(self, action, nodeid, newvalues): - '''Fire all registered auditors. - ''' - for audit in self.auditors[action]: - audit(self.db, self, nodeid, newvalues) - - def react(self, event, detector): - '''Register a detector - ''' - l = self.reactors[event] - if detector not in l: - self.reactors[event].append(detector) - - def fireReactors(self, action, nodeid, oldvalues): - '''Fire all registered reactors. - ''' - for react in self.reactors[action]: - react(self.db, self, nodeid, oldvalues) - # # import / export support #
