Commit e4282ddf authored by Jérome Perrin's avatar Jérome Perrin Committed by wenjie.zheng

Revert "datetime widget : allow definition of a default timezone"

This reverts commit 9668c1a1.

The problem of timezone is more complex.
Since this commit have a side effect of saving and displaying a different date
when Zope runs on a different timezone that what is configured on the field, it
is safer to revert this commit immediately.
parent 14f04001
......@@ -69,10 +69,6 @@
<key> <string>default_now</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_timezone</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
......@@ -125,10 +121,6 @@
<key> <string>time_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>timezone_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
......@@ -178,10 +170,6 @@
<key> <string>default_now</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_timezone</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
......@@ -236,10 +224,6 @@
<key> <string>time_separator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>timezone_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
......@@ -285,10 +269,6 @@
<key> <string>default_now</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>default_timezone</string> </key>
<value> <string>GMT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>The Date</string> </value>
......@@ -361,7 +341,13 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="BasicForm" module="Products.Formulator.Form"/>
<tuple>
<tuple>
<string>Products.Formulator.Form</string>
<string>BasicForm</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
......@@ -411,16 +397,10 @@
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key> <string>timezone</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
<item>
<key> <string>year</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -463,7 +443,6 @@
<string>hour</string>
<string>minute</string>
<string>ampm</string>
<string>timezone</string>
</list>
</value>
</item>
......@@ -495,7 +474,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
......@@ -1760,366 +1745,6 @@
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="ListField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>timezone</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>date_field</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string>GMT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list>
<tuple>
<string>GMT-12</string>
<string>GMT-12</string>
</tuple>
<tuple>
<string>GMT-11</string>
<string>GMT-11</string>
</tuple>
<tuple>
<string>GMT-10</string>
<string>GMT-10</string>
</tuple>
<tuple>
<string>GMT-9</string>
<string>GMT-9</string>
</tuple>
<tuple>
<string>GMT-8</string>
<string>GMT-8</string>
</tuple>
<tuple>
<string>GMT-7</string>
<string>GMT-7</string>
</tuple>
<tuple>
<string>GMT-6</string>
<string>GMT-6</string>
</tuple>
<tuple>
<string>GMT-5</string>
<string>GMT-5</string>
</tuple>
<tuple>
<string>GMT-4</string>
<string>GMT-4</string>
</tuple>
<tuple>
<string>GMT-3</string>
<string>GMT-3</string>
</tuple>
<tuple>
<string>GMT-2</string>
<string>GMT-2</string>
</tuple>
<tuple>
<string>GMT-1</string>
<string>GMT-1</string>
</tuple>
<tuple>
<string>GMT</string>
<string>GMT</string>
</tuple>
<tuple>
<string>GMT+1</string>
<string>GMT+1</string>
</tuple>
<tuple>
<string>GMT+2</string>
<string>GMT+2</string>
</tuple>
<tuple>
<string>GMT+3</string>
<string>GMT+3</string>
</tuple>
<tuple>
<string>GMT+4</string>
<string>GMT+4</string>
</tuple>
<tuple>
<string>GMT+5</string>
<string>GMT+5</string>
</tuple>
<tuple>
<string>GMT+6</string>
<string>GMT+6</string>
</tuple>
<tuple>
<string>GMT+7</string>
<string>GMT+7</string>
</tuple>
<tuple>
<string>GMT+8</string>
<string>GMT+8</string>
</tuple>
<tuple>
<string>GMT+9</string>
<string>GMT+9</string>
</tuple>
<tuple>
<string>GMT+10</string>
<string>GMT+10</string>
</tuple>
<tuple>
<string>GMT+11</string>
<string>GMT+11</string>
</tuple>
<tuple>
<string>GMT+12</string>
<string>GMT+12</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Timezone</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="IntegerField" module="Products.Formulator.StandardFields"/>
</pickle>
......
......@@ -184,6 +184,10 @@ class DateTimeField(ZMIField):
if REQUEST.form['subfield_%s_%s' % (key, 'year')]:
return None
gmt_timezones = [('GMT%s' %zone, 'GMT%s' %zone,) for zone in range(-12, 0)]\
+ [('GMT', 'GMT',),] \
+ [('GMT+%s' %zone, 'GMT+%s' %zone,) for zone in range(1, 13)]
def create_datetime_text_sub_form():
sub_form = BasicForm()
......@@ -234,7 +238,7 @@ def create_datetime_text_sub_form():
title = "Timezone",
required = 0,
default = 'GMT',
items = Widget.gmt_timezones,
items = gmt_timezones,
size = 1)
sub_form.add_fields([hour, minute, ampm, timezone], "time")
return sub_form
......@@ -292,7 +296,7 @@ def create_datetime_list_sub_form():
title = "Timezone",
required = 0,
default = 'GMT',
items = Widget.gmt_timezones,
items = gmt_timezones,
size = 1)
sub_form.add_group("time")
......
......@@ -1280,10 +1280,6 @@ class MultiCheckBoxWidget(MultiItemsWidget):
MultiCheckBoxWidgetInstance = MultiCheckBoxWidget()
gmt_timezones = [('GMT%s' %zone, 'GMT%s' %zone,) for zone in range(-12, 0)]\
+ [('GMT', 'GMT',),] \
+ [('GMT+%s' %zone, 'GMT+%s' %zone,) for zone in range(1, 13)]
class DateTimeWidget(Widget):
"""
Added support for key in every call to render_sub_field
......@@ -1365,15 +1361,6 @@ class DateTimeWidget(Widget):
("list", "list")],
size=1)
default_timezone = fields.ListField('default_timezone',
title="Default Timezone",
description=(
"The default timezone display when inputing a new date"),
default="GMT",
items=gmt_timezones,
required=1,
size=1)
input_order = fields.ListField('input_order',
title="Input order",
description=(
......@@ -1401,8 +1388,8 @@ class DateTimeWidget(Widget):
property_names = Widget.property_names +\
['default_now', 'date_separator', 'time_separator',
'input_style', 'input_order', 'date_only',
'ampm_time_style', 'timezone_style', 'default_timezone',
'hide_day', 'hidden_day_is_last_day']
'ampm_time_style', 'timezone_style', 'hide_day',
'hidden_day_is_last_day']
def getInputOrder(self, field):
input_order = field.get_value('input_order')
......@@ -1460,7 +1447,7 @@ class DateTimeWidget(Widget):
hour = None
minute = None
ampm = None
timezone = field.get_value("default_timezone")
timezone = None
if isinstance(value, DateTime):
year = "%04d" % value.year()
month = "%02d" % value.month()
......
......@@ -280,7 +280,6 @@ class SerializeTestCase(unittest.TestCase):
request.update(default_values)
request.update( {'field_input_style': 'list',
'field_input_order': 'mdy',
'field_default_timezone': 'GMT',
'field_date_only': '',
'field_css_class': 'test_css',
'field_time_separator': '$',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment