summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 924168f)
raw | patch | inline | side by side (parent: 924168f)
| author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Fri, 14 Feb 2003 00:31:46 +0000 (00:31 +0000) | ||
| committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
| Fri, 14 Feb 2003 00:31:46 +0000 (00:31 +0000) |
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.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1509 57a73879-2fb5-44c3-a270-3262357dd7e2
Added "author" and "date" props to messages created by ":note". It might be
useful to keep that alive as a convenience variable.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1509 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/CHANGES.txt b/CHANGES.txt
index dd58c3d8a8d7d83e330fea2796db69735a44b304..45ab7bf5cb70f7564e3710d9c523ba428e58bbcf 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- the colon ":" special form variable designator may now be any of : + @
- trackers' templates directory can contain subdirectories with static files
(e.g. images). They are accessible naturally: _file/images/img.gif
+- altered Class.create() and FileClass.create() methods to make "content"
+ property available in auditors
2003-??-?? 0.5.6
index 8d389c30d511aa1b059dd228db02a178d9219d0a..1971ccade4254cd4a81a29da76f441e07a960de6 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.102 2003-02-13 07:33:38 richard Exp $
+#$Id: back_anydbm.py,v 1.103 2003-02-14 00:31:44 richard 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
These operations trigger detectors and can be vetoed. Attempts
to modify the "creation" or "activity" properties cause a KeyError.
'''
+ 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'
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)
if self.do_journal:
self.db.addjournal(self.classname, newid, 'create', {})
- self.fireReactors('create', newid, None)
-
return newid
def export_list(self, propnames, nodeid):
default_mime_type = 'text/plain'
def create(self, **propvalues):
- ''' snaffle the file propvalue and store in a file
+ ''' Snarf the "content" 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
index 711a41b57e7ffa0586830cf3f8a166d5592bba4d..9e5a8b88298de75f4c1f24be06e2db532e3a63d3 100755 (executable)
# --- the hyperdb.Class methods
def create(self, **propvalues):
self.fireAuditors('create', None, propvalues)
+ newid = self.create_inner(**propvalues)
+ # self.set() (called in self.create_inner()) does reactors)
+ return newid
+
+ def create_inner(self, **propvalues):
rowdict = {}
rowdict['id'] = newid = self.maxid
self.maxid += 1
row.creation = int(time.time())
if not row.creator:
row.creator = self.db.curuserid
-
+
self.db.dirty = 1
if self.do_journal:
if isnew:
return x
def create(self, **propvalues):
+ self.fireAuditors('create', None, propvalues)
content = propvalues['content']
del propvalues['content']
- newid = Class.create(self, **propvalues)
+ newid = Class.create_inner(self, **propvalues)
if not content:
return newid
nm = bnm = '%s%s' % (self.classname, newid)
index 1214555c28444cb5f7f062079f7067ee56fdcfdc..1fa6cd85d2c3e0064cc04c67ed0e7f376800a138 100644 (file)
-# $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:
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'
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)
if self.do_journal:
self.db.addjournal(self.classname, newid, 'create', {})
- self.fireReactors('create', newid, None)
-
return newid
def export_list(self, propnames, nodeid):
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
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:
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index ac8d9d451981c18cb5ff7322e2d7b255a100c434..10015b317ef3b87eb84ffd69f08cbb9896bfe255 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.84 2003-02-13 12:10:34 kedder Exp $
+# $Id: client.py,v 1.85 2003-02-14 00:31:46 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
if newids is None:
newids = {}
for (cn, nodeid), props in all_props.items():
- print ((cn, nodeid), props)
if int(nodeid) > 0:
# make changes to the node
props = self._changenode(cn, nodeid, props)
diff --git a/test/test_cgi.py b/test/test_cgi.py
index b0a2cd0c1fb6e993d49c338b8dd30e0b75fc320d..4cb01137d93fcc57102ff0b0478c61fc58edbfa4 100644 (file)
--- a/test/test_cgi.py
+++ b/test/test_cgi.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_cgi.py,v 1.8 2003-02-13 07:38:34 richard Exp $
+# $Id: test_cgi.py,v 1.9 2003-02-14 00:31:46 richard Exp $
import unittest, os, shutil, errno, sys, difflib, cgi
{'test-1@:link:link': 'issue'})
def testBackwardsCompat(self):
- self.assertEqual(self.parseForm({':note': 'spam'}, 'issue'),
- ({('issue', None): {}, ('msg', '-1'): {'content': 'spam'}},
+ res = self.parseForm({':note': 'spam'}, 'issue')
+ date = res[0][('msg', '-1')]['date']
+ self.assertEqual(res, ({('issue', None): {}, ('msg', '-1'):
+ {'content': 'spam', 'author': '1', 'date': date}},
[('issue', None, 'messages', [('msg', '-1')])]))
file = FileUpload('foo', 'foo.txt')
self.assertEqual(self.parseForm({':file': file}, 'issue'),