Line 0
Link Here
|
|
|
1 |
--- lib/python/Zope2/Startup/zopeschema.xml.orig 2009-05-20 10:09:56.000000000 +0200 |
2 |
+++ lib/python/Zope2/Startup/zopeschema.xml 2009-05-20 09:02:27.000000000 +0200 |
3 |
@@ -444,6 +444,14 @@ |
4 |
<metadefault>us</metadefault> |
5 |
</key> |
6 |
|
7 |
+ <key name="datetime-default-localtimezone" datatype="boolean" default="off"> |
8 |
+ <description> |
9 |
+ By default datetime uses the UTC timezone if no timezone is given. |
10 |
+ Set this option to on to use system local time zone as default time zone. |
11 |
+ </description> |
12 |
+ <metadefault>off</metadefault> |
13 |
+ </key> |
14 |
+ |
15 |
<key name="zserver-threads" datatype="integer" default="4"> |
16 |
<description> |
17 |
Specify the number of threads that Zope's ZServer web server will use |
18 |
--- lib/python/DateTime/DateTime.py.orig 2009-05-20 09:09:32.000000000 +0200 |
19 |
+++ lib/python/DateTime/DateTime.py 2009-05-20 10:12:07.000000000 +0200 |
20 |
@@ -16,13 +16,14 @@ |
21 |
|
22 |
|
23 |
import re, math, DateTimeZone |
24 |
-from time import time, gmtime, localtime |
25 |
+from time import time, gmtime, localtime, strptime, mktime |
26 |
from time import daylight, timezone, altzone, strftime |
27 |
from datetime import datetime |
28 |
from interfaces import IDateTime |
29 |
from interfaces import DateTimeError, SyntaxError, DateError, TimeError |
30 |
from zope.interface import implements |
31 |
from pytz_support import PytzCache |
32 |
+from App.config import getConfiguration |
33 |
_cache = PytzCache |
34 |
|
35 |
default_datefmt = None |
36 |
@@ -31,7 +32,6 @@ |
37 |
global default_datefmt |
38 |
if default_datefmt is None: |
39 |
try: |
40 |
- from App.config import getConfiguration |
41 |
default_datefmt = getConfiguration().datetime_format |
42 |
return default_datefmt |
43 |
except: |
44 |
@@ -1805,10 +1805,14 @@ |
45 |
if fields['signal'] or fields['Z']: |
46 |
tznaive = False |
47 |
else: |
48 |
- tznaive = True |
49 |
+ if getConfiguration().datetime_default_localtimezone : |
50 |
+ dtstr = "%04.4d-%02.2d-%02.2d %02.2d:%02.2d:%02.2d" % (year, month, day, hour, minute, seconds) |
51 |
+ dsttime = strptime(dtstr, "%Y-%m-%d %H:%M:%S") |
52 |
+ dsdtime = localtime(mktime(dsttime)) |
53 |
+ ltzoff = _tzoffset(self.localZone(dsdtime), None) |
54 |
+ hour_off = ltzoff / 3600 |
55 |
+ min_off = (ltzoff % 3600) / 60 |
56 |
|
57 |
- # Differ from the specification here. To preserve backwards |
58 |
- # compatibility assume a default timezone == UTC. |
59 |
tz = 'GMT%+03d%02d' % (hour_off, min_off) |
60 |
|
61 |
return year, month, day, hour, minute, seconds, tz, tznaive |
62 |
--- skel/etc/zope.conf.in.orig 2009-06-22 08:30:40.000000000 +0200 |
63 |
+++ skel/etc/zope.conf.in 2009-06-22 08:31:15.000000000 +0200 |
64 |
@@ -204,6 +204,19 @@ |
65 |
# datetime-format international |
66 |
|
67 |
|
68 |
+# Directive: datetime-default-localtimezone |
69 |
+# |
70 |
+# Description: |
71 |
+# By default datetime uses the UTC timezone if no timezone is given. |
72 |
+# Set this option to on to use system local time zone as default time zone. |
73 |
+# |
74 |
+# Default: off |
75 |
+# |
76 |
+# Example: |
77 |
+# |
78 |
+# datetime-default-localtimezone on |
79 |
+ |
80 |
+ |
81 |
# Directive: zserver-threads |
82 |
# |
83 |
# Description: |