Mercurial > p > roundup > code
diff roundup/backends/rdbms_common.py @ 1431:c70068162e64
Altered Class.create() and FileClass.create() methods...
...to make "content" property available in auditors
Added "author" and "date" props to messages created by ":note". It might be
useful to keep that alive as a convenience variable.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 14 Feb 2003 00:31:46 +0000 |
| parents | 472c21af7f69 |
| children | b42fa71754c9 |
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py Fri Feb 14 00:08:32 2003 +0000 +++ b/roundup/backends/rdbms_common.py Fri Feb 14 00:31:46 2003 +0000 @@ -1,4 +1,4 @@ -# $Id: rdbms_common.py,v 1.32 2003-02-12 00:00:25 richard Exp $ +# $Id: rdbms_common.py,v 1.33 2003-02-14 00:31:45 richard Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -985,6 +985,14 @@ If an id in a link or multilink property does not refer to a valid node, an IndexError is raised. ''' + self.fireAuditors('create', None, propvalues) + newid = self.create_inner(**propvalues) + self.fireReactors('create', newid, None) + return newid + + def create_inner(self, **propvalues): + ''' Called by create, in-between the audit and react calls. + ''' if propvalues.has_key('id'): raise KeyError, '"id" is reserved' @@ -994,8 +1002,6 @@ if propvalues.has_key('creation') or propvalues.has_key('activity'): raise KeyError, '"creation" and "activity" are reserved' - self.fireAuditors('create', None, propvalues) - # new node's id newid = self.db.newid(self.classname) @@ -1115,8 +1121,6 @@ if self.do_journal: self.db.addjournal(self.classname, newid, 'create', {}) - self.fireReactors('create', newid, None) - return newid def export_list(self, propnames, nodeid): @@ -1987,9 +1991,21 @@ def create(self, **propvalues): ''' snaffle the file propvalue and store in a file ''' + # we need to fire the auditors now, or the content property won't + # be in propvalues for the auditors to play with + self.fireAuditors('create', None, propvalues) + + # now remove the content property so it's not stored in the db content = propvalues['content'] del propvalues['content'] - newid = Class.create(self, **propvalues) + + # do the database create + newid = Class.create_inner(self, **propvalues) + + # fire reactors + self.fireReactors('create', newid, None) + + # store off the content as a file self.db.storefile(self.classname, newid, None, content) return newid @@ -2016,7 +2032,6 @@ def get(self, nodeid, propname, default=_marker, cache=1): ''' trap the content propname and get it from the file ''' - poss_msg = 'Possibly a access right configuration problem.' if propname == 'content': try:
