comparison roundup/roundupdb.py @ 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 eca3383a27a6
children 37e2b70105f7
comparison
equal deleted inserted replaced
2733:ef396596a24e 2735:85b9dcf908a2
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
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 $
19 19
20 """Extending hyperdb with types specific to issue-tracking. 20 """Extending hyperdb with types specific to issue-tracking.
21 """ 21 """
22 __docformat__ = 'restructuredtext' 22 __docformat__ = 'restructuredtext'
23 23
32 32
33 # MessageSendError is imported for backwards compatibility 33 # MessageSendError is imported for backwards compatibility
34 from roundup.mailer import Mailer, straddr, MessageSendError 34 from roundup.mailer import Mailer, straddr, MessageSendError
35 35
36 class Database: 36 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
37 def getuid(self): 43 def getuid(self):
38 """Return the id of the "user" node associated with the user 44 """Return the id of the "user" node associated with the user
39 that owns this connection to the hyperdatabase.""" 45 that owns this connection to the hyperdatabase."""
40 if self.journaltag is None: 46 if self.journaltag is None:
41 return None 47 return None
42 elif self.journaltag == 'admin': 48 elif self.journaltag == 'admin':
43 # admin user may not exist, but always has ID 1 49 # admin user may not exist, but always has ID 1
44 return '1' 50 return '1'
45 else: 51 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]
47 57
48 def getUserTimezone(self): 58 def getUserTimezone(self):
49 """Return user timezone defined in 'timezone' property of user class. 59 """Return user timezone defined in 'timezone' property of user class.
50 If no such property exists return 0 60 If no such property exists return 0
51 """ 61 """

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