Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 1402:27586da5557c
Added users' timezone support
| author | Andrey Lebedev <kedder@users.sourceforge.net> |
|---|---|
| date | Mon, 27 Jan 2003 16:32:50 +0000 |
| parents | f19dde90e473 |
| children | f7d3421ce7e7 |
line wrap: on
line diff
--- a/roundup/roundupdb.py Fri Jan 24 06:22:03 2003 +0000 +++ b/roundup/roundupdb.py Mon Jan 27 16:32:50 2003 +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.78 2003-01-15 22:17:19 kedder Exp $ +# $Id: roundupdb.py,v 1.79 2003-01-27 16:32:48 kedder Exp $ __doc__ = """ Extending hyperdb with types specific to issue-tracking. @@ -55,6 +55,20 @@ that owns this connection to the hyperdatabase.""" return self.user.lookup(self.journaltag) + def getUserTimezone(self): + """Return user timezone defined in 'timezone' property of user class. + If no such property exists return 0 + """ + userid = self.getuid() + try: + timezone = int(self.user.get(userid, 'timezone')) + except (KeyError, ValueError): + # If there is no class 'user' or current user doesn't have timezone + # property or that property is not numeric assume he/she lives in + # Greenwich :) + timezone = 0 + return timezone + class MessageSendError(RuntimeError): pass
