diff roundup/backends/rdbms_common.py @ 1176:bd3b57859c37

On second thought, that last checkin was dumb. The old, nasty, for-purely-historical-reasons journaltag-as-username has gone away now. The code should handle existing journaltag-as-username entries, but will use userid from now on.
author Richard Jones <richard@users.sourceforge.net>
date Fri, 20 Sep 2002 05:08:00 +0000
parents 762f48bfbc0b
children 49aebf5a8691
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Fri Sep 20 01:48:34 2002 +0000
+++ b/roundup/backends/rdbms_common.py	Fri Sep 20 05:08:00 2002 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.8 2002-09-20 01:48:34 richard Exp $
+# $Id: rdbms_common.py,v 1.9 2002-09-20 05:08:00 richard Exp $
 
 # standard python modules
 import sys, os, time, re, errno, weakref, copy
@@ -115,6 +115,15 @@
         # commit
         self.conn.commit()
 
+        # figure the "curuserid"
+        if self.journaltag is None:
+            self.curuserid = None
+        elif self.journaltag == 'admin':
+            # admin user may not exist, but always has ID 1
+            self.curuserid = '1'
+        else:
+            self.curuserid = self.user.lookup(self.journaltag)
+
     def reindex(self):
         for klass in self.classes.values():
             for nodeid in klass.list():
@@ -461,7 +470,7 @@
         # add the special props
         node = node.copy()
         node['creation'] = node['activity'] = date.Date()
-        node['creator'] = self.journaltag
+        node['creator'] = self.curuserid
 
         # default the non-multilink columns
         for col, prop in cl.properties.items():
@@ -769,7 +778,7 @@
         if creator:
             journaltag = creator
         else:
-            journaltag = self.journaltag
+            journaltag = self.curuserid
         if creation:
             journaldate = creation.serialise()
         else:
@@ -1199,7 +1208,7 @@
             if d.has_key('creator'):
                 return d['creator']
             else:
-                return self.db.journaltag
+                return self.db.curuserid
 
         # get the property (raises KeyErorr if invalid)
         prop = self.properties[propname]
@@ -1788,7 +1797,7 @@
             d['id'] = String()
             d['creation'] = hyperdb.Date()
             d['activity'] = hyperdb.Date()
-            d['creator'] = hyperdb.String()
+            d['creator'] = hyperdb.Link('user')
         return d
 
     def addprop(self, **properties):

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