Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 8304:24549122f9b1
Factor common code to hyperdb/roundupdb
There was some common copied code in backends/back_anydbm.py and
backends/rdbms_common.py. This is now moved to hyperdb.py and
roundupdb.py, respectively (the FileClass lives in hyperdb.py while the
IssueClass is in roundupdb.py)
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Sat, 01 Mar 2025 13:08:09 +0100 |
| parents | 216662fbaaee |
| children |
line wrap: on
line diff
--- a/roundup/roundupdb.py Thu Feb 27 10:05:38 2025 +0100 +++ b/roundup/roundupdb.py Sat Mar 01 13:08:09 2025 +0100 @@ -197,7 +197,7 @@ pass -# deviation from spec - was called IssueClass +# deviation from spec - was called ItemClass class IssueClass: """This class is intended to be mixed-in with a hyperdb backend implementation. The backend should provide a mechanism that @@ -228,6 +228,27 @@ ''"actor", ''"activity", ''"creator", ''"creation", ) + def _update_properties(self, classname, properties): + """The newly-created class automatically includes the "messages", + "files", "nosy", and "superseder" properties. If the 'properties' + dictionary attempts to specify any of these properties or a + "creation", "creator", "activity" or "actor" property, a ValueError + is raised. This method must be called by __init__. + + """ + if 'title' not in properties: + properties['title'] = hyperdb.String(indexme='yes') + if 'messages' not in properties: + properties['messages'] = hyperdb.Multilink("msg") + if 'files' not in properties: + properties['files'] = hyperdb.Multilink("file") + if 'nosy' not in properties: + # note: journalling is turned off as it really just wastes + # space. this behaviour may be overridden in an instance + properties['nosy'] = hyperdb.Multilink("user", do_journal="no") + if 'superseder' not in properties: + properties['superseder'] = hyperdb.Multilink(classname) + # New methods: def addmessage(self, issueid, summary, text): """Add a message to an issue's mail spool.
