Skip to content

Commit b08f976

Browse files
author
Alexander Smishlajev
committed
timezone support (patch [SF#1465296])
1 parent 39ce8a5 commit b08f976

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

roundup/hyperdb.py

Lines changed: 2 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: hyperdb.py,v 1.119 2006-04-27 01:39:47 richard Exp $
18+
# $Id: hyperdb.py,v 1.120 2006-05-06 17:18:03 a1s Exp $
1919

2020
"""Hyperdatabase implementation, especially field types.
2121
"""
@@ -78,7 +78,7 @@ def offset (self, db) :
7878
return db.getUserTimezone ()
7979
def from_raw(self, value, db, **kw):
8080
try:
81-
value = date.Date(value).local(-self.offset(db))
81+
value = date.Date(value, self.offset(db))
8282
except ValueError, message:
8383
raise HyperdbValueError, 'property %s: %r is an invalid '\
8484
'date (%s)'%(kw['propname'], value, message)

roundup/roundupdb.py

Lines changed: 12 additions & 7 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.123 2006-04-27 01:39:47 richard Exp $
18+
# $Id: roundupdb.py,v 1.124 2006-05-06 17:19:58 a1s Exp $
1919

2020
"""Extending hyperdb with types specific to issue-tracking.
2121
"""
@@ -72,13 +72,18 @@ def getUserTimezone(self):
7272
If no such property exists return 0
7373
"""
7474
userid = self.getuid()
75+
timezone = None
7576
try:
76-
timezone = int(self.user.get(userid, 'timezone'))
77-
except (KeyError, ValueError, TypeError):
78-
# If there is no class 'user' or current user doesn't have timezone
79-
# property or that property is not numeric assume he/she lives in
80-
# Greenwich :)
81-
timezone = getattr(self.config, 'DEFAULT_TIMEZONE', 0)
77+
tz = self.user.get(userid, 'timezone')
78+
date.get_timezone(tz)
79+
timezone = tz
80+
except KeyError:
81+
pass
82+
# If there is no class 'user' or current user doesn't have timezone
83+
# property or that property is not set assume he/she lives in
84+
# the timezone set in the tracker config.
85+
if timezone is None:
86+
timezone = self.config['TIMEZONE']
8287
return timezone
8388

8489
def confirm_registration(self, otk):

0 commit comments

Comments
 (0)