1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: roundupdb.py,v 1.112 2004-07-14 01:10:51 richard Exp $
18+ # $Id: roundupdb.py,v 1.113 2004-10-08 01:58:43 richard Exp $
1919
2020"""Extending hyperdb with types specific to issue-tracking.
2121"""
3434from roundup .mailer import Mailer , straddr , MessageSendError
3535
3636class Database :
37+
38+ # remember the journal uid for the current journaltag so that:
39+ # a. we don't have to look it up every time we need it, and
40+ # b. if the journaltag disappears during a transaction, we don't barf
41+ # (eg. the current user edits their username)
42+ journal_uid = None
3743 def getuid (self ):
3844 """Return the id of the "user" node associated with the user
3945 that owns this connection to the hyperdatabase."""
@@ -43,7 +49,11 @@ def getuid(self):
4349 # admin user may not exist, but always has ID 1
4450 return '1'
4551 else :
46- return self .user .lookup (self .journaltag )
52+ if (self .journal_uid is None or self .journal_uid [0 ] !=
53+ self .journaltag ):
54+ uid = self .user .lookup (self .journaltag )
55+ self .journal_uid = (self .journaltag , uid )
56+ return self .journal_uid [1 ]
4757
4858 def getUserTimezone (self ):
4959 """Return user timezone defined in 'timezone' property of user class.
0 commit comments