Skip to content

Commit 2d25e94

Browse files
author
Richard Jones
committed
fix DateHTMLProperty so local() can override user timezone [SF#953678]
1 parent b90e9ff commit 2d25e94

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Fixed:
1414
- HTML templating isset() inverted (sf bug 951779)
1515
- otks manager missing (sf bug 952931)
1616
- mention DEFAULT_TIMEZONE requirement in upgrading doc (sf bug 952932)
17+
- fix DateHTMLProperty so local() can override user timezone (sf bug
18+
953678)
1719

1820

1921
2004-05-10 0.7.1

doc/index.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@ John P. Rouillard,
115115
Ollie Rutherfurd,
116116
Toby Sargeant,
117117
Florian Schulze,
118+
Klamer Schutte,
118119
Dougal Scott,
119120
Stefan Seefeld,
120121
Jeffrey P Shell,
121-
Klamer Schutte,
122122
Joel Shprentz,
123123
Terrel Shumway,
124+
Emil Sit,
124125
Alexander Smishlajev,
125126
Nathaniel Smith,
126127
Mike Thompson,

roundup/cgi/templating.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ def submit(self, label="Submit Changes"):
671671
Also sneak in the lastactivity and action hidden elements.
672672
"""
673673
return self.input(type="hidden", name="@lastactivity",
674-
value=self.activity) + '\n' + \
674+
value=self.activity.local(0)) + '\n' + \
675675
self.input(type="hidden", name="@action", value="edit") + '\n' + \
676676
self.input(type="submit", name="submit", value=label)
677677

@@ -1269,14 +1269,24 @@ def field(self):
12691269
return s
12701270

12711271
class DateHTMLProperty(HTMLProperty):
1272+
def __init__(self, client, classname, nodeid, prop, name, value,
1273+
anonymous=0, offset=None):
1274+
HTMLProperty.__init__(self, client, classname, nodeid, prop, name,
1275+
value, anonymous=anonymous)
1276+
self._offset = offset
1277+
12721278
def plain(self):
12731279
''' Render a "plain" representation of the property
12741280
'''
12751281
self.view_check()
12761282

12771283
if self._value is None:
12781284
return ''
1279-
return str(self._value.local(self._db.getUserTimezone()))
1285+
if self._offset is None:
1286+
offset = self._db.getUserTimezone()
1287+
else:
1288+
offset = self._offset
1289+
return str(self._value.local(offset))
12801290

12811291
def now(self):
12821292
''' Return the current time.
@@ -1346,7 +1356,7 @@ def local(self, offset):
13461356
self.view_check()
13471357

13481358
return DateHTMLProperty(self._client, self._classname, self._nodeid,
1349-
self._prop, self._formname, self._value.local(offset))
1359+
self._prop, self._formname, self._value, offset=offset)
13501360

13511361
class IntervalHTMLProperty(HTMLProperty):
13521362
def plain(self):

0 commit comments

Comments
 (0)