Skip to content

Commit a019d52

Browse files
author
Richard Jones
committed
record journaltag lookup ("fixes" [SF#998140])
1 parent 8a07c04 commit a019d52

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Feature:
2727
- roundup-admin reindex command may now work on single items or classes
2828
- multiple selection Link/Multilink search field (thanks Marlon van den Berg)
2929
- relaxed hyperlinking in web interface (accept "issue123" or "Issue 123")
30+
- record journaltag lookup ("fixes" sf bug 998140)
3031

3132

3233
2004-??-?? 0.7.7

roundup/roundupdb.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
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
"""
@@ -34,6 +34,12 @@
3434
from roundup.mailer import Mailer, straddr, MessageSendError
3535

3636
class 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

Comments
 (0)