changeset 2735:85b9dcf908a2

record journaltag lookup ("fixes" [SF#998140])
author Richard Jones <richard@users.sourceforge.net>
date Fri, 08 Oct 2004 01:58:43 +0000
parents ef396596a24e
children 402d6d556558
files CHANGES.txt roundup/roundupdb.py
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Fri Oct 08 01:28:32 2004 +0000
+++ b/CHANGES.txt	Fri Oct 08 01:58:43 2004 +0000
@@ -27,6 +27,7 @@
 - roundup-admin reindex command may now work on single items or classes
 - multiple selection Link/Multilink search field (thanks Marlon van den Berg)
 - relaxed hyperlinking in web interface (accept "issue123" or "Issue 123")
+- record journaltag lookup ("fixes" sf bug 998140)
 
 
 2004-??-?? 0.7.7
--- a/roundup/roundupdb.py	Fri Oct 08 01:28:32 2004 +0000
+++ b/roundup/roundupdb.py	Fri Oct 08 01:58:43 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-# $Id: roundupdb.py,v 1.112 2004-07-14 01:10:51 richard Exp $
+# $Id: roundupdb.py,v 1.113 2004-10-08 01:58:43 richard Exp $
 
 """Extending hyperdb with types specific to issue-tracking.
 """
@@ -34,6 +34,12 @@
 from roundup.mailer import Mailer, straddr, MessageSendError
 
 class Database:
+
+    # remember the journal uid for the current journaltag so that:
+    # a. we don't have to look it up every time we need it, and
+    # b. if the journaltag disappears during a transaction, we don't barf
+    #    (eg. the current user edits their username)
+    journal_uid = None
     def getuid(self):
         """Return the id of the "user" node associated with the user
         that owns this connection to the hyperdatabase."""
@@ -43,7 +49,11 @@
             # admin user may not exist, but always has ID 1
             return '1'
         else:
-            return self.user.lookup(self.journaltag)
+            if (self.journal_uid is None or self.journal_uid[0] !=
+                    self.journaltag):
+                uid = self.user.lookup(self.journaltag)
+                self.journal_uid = (self.journaltag, uid)
+            return self.journal_uid[1]
 
     def getUserTimezone(self):
         """Return user timezone defined in 'timezone' property of user class.

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