Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
e29bbfd4
Commit
e29bbfd4
authored
Nov 08, 2004
by
Lennart Regebro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged Zope/branches/regebro-strftime_1127 28397:28400; bugfix for issue #1127
parent
d49c0671
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/DateTime/DateTime.py
lib/python/DateTime/DateTime.py
+1
-5
lib/python/DateTime/tests/testDateTime.py
lib/python/DateTime/tests/testDateTime.py
+11
-0
No files found.
doc/CHANGES.txt
View file @
e29bbfd4
...
...
@@ -36,6 +36,8 @@ Zope Changes
Statistics view in the ZMI
Bugs fixed
- Collector #1127: strftime did not take timezone into account.
- ZPublisher: changed some hardcoded 'latin1' arguments to 'iso-8859-15'
since latin1 is obsolete.
...
...
lib/python/DateTime/DateTime.py
View file @
e29bbfd4
...
...
@@ -1476,11 +1476,7 @@ class DateTime:
def
strftime
(
self
,
format
):
# Format the date/time using the *current timezone representation*.
diff
=
_tzoffset
(
self
.
_tz
,
self
.
_t
)
format
=
re
.
sub
(
'(^
\
|[^%])%z
'
,
'
\\
1
%+
05
d
' % (diff / 36),
format)
return strftime(format, safegmtime(self.timeTime() + diff))
return
strftime
(
format
,
safelocaltime
(
self
.
timeTime
()))
# General formats from previous DateTime
def
Date
(
self
):
...
...
lib/python/DateTime/tests/testDateTime.py
View file @
e29bbfd4
...
...
@@ -7,6 +7,7 @@ import os
import
time
import
unittest
from
DateTime.DateTime
import
_findLocalTimeZoneName
from
DateTime
import
DateTime
try
:
...
...
@@ -338,6 +339,16 @@ class DateTimeTests(unittest.TestCase):
except
DateTime
.
TimeError
:
self
.
fail
(
'Zope Collector issue #484 (negative time bug): '
'TimeError raised'
)
def
testStrftimeTZhandling
(
self
):
'''strftime timezone testing'''
# This is a test for collector issue #1127
format
=
'%Y-%m-%d %H:%M %Z'
dt
=
DateTime
(
'Wed, 19 Nov 2003 18:32:07 -0215'
)
dt_string
=
dt
.
strftime
(
format
)
dt_local
=
dt
.
toZone
(
_findLocalTimeZoneName
(
0
))
dt_localstring
=
dt_local
.
strftime
(
format
)
self
.
assertEqual
(
dt_string
,
dt_localstring
)
def
test_suite
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment