Skip to content

Commit

Permalink
[fc] Repository: plone.app.form
Browse files Browse the repository at this point in the history
Branch: refs/heads/2.2.x
Date: 2015-04-17T15:12:33+02:00
Author: Luca Fabbri (keul) <luca@keul.it>
Commit: plone/plone.app.form@d3bb395

Close #8

Files changed:
M plone/app/form/widgets/datecomponents.py
M plone/app/form/widgets/datecomponents.txt
Repository: plone.app.form
Branch: refs/heads/2.2.x
Date: 2015-04-17T15:13:30+02:00
Author: Luca Fabbri (keul) <luca@keul.it>
Commit: plone/plone.app.form@cbe7093

Updated CHANGES

Files changed:
M CHANGES.txt
Repository: plone.app.form
Branch: refs/heads/2.2.x
Date: 2015-04-26T20:41:23+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.form@da0259a

Merge pull request #10 from plone/issue-8-localization

Issue 8 localization

Files changed:
M CHANGES.txt
M plone/app/form/widgets/datecomponents.py
M plone/app/form/widgets/datecomponents.txt
  • Loading branch information
jensens committed Apr 26, 2015
1 parent 5b3d01d commit a433216
Showing 1 changed file with 128 additions and 54 deletions.
182 changes: 128 additions & 54 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,82 +1,156 @@
Repository: Products.PlonePAS
Branch: refs/heads/4.1.x
Date: 2015-04-26T12:45:37-04:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/Products.PlonePAS/commit/00eb6db80d637107345b1e2228e045e3035d7f50
Repository: plone.app.form
Branch: refs/heads/2.2.x
Date: 2015-04-17T15:12:33+02:00
Author: Luca Fabbri (keul) <luca@keul.it>
Commit: https://github.com/plone/plone.app.form/commit/d3bb395b725c7818cc6921adcf205f4b04722e0e

Preparing release 4.1.5
Close #8

Files changed:
M plone/app/form/widgets/datecomponents.py
M plone/app/form/widgets/datecomponents.txt

diff --git a/plone/app/form/widgets/datecomponents.py b/plone/app/form/widgets/datecomponents.py
index f61c0ee..177c4b7 100644
--- a/plone/app/form/widgets/datecomponents.py
+++ b/plone/app/form/widgets/datecomponents.py
@@ -215,7 +215,7 @@ def result(self, date=None,

for x in ('AM', 'PM'):
d={'id': x, 'value': x, 'selected': None}
- if x==p and not default:
+ if x==p.upper() and not default:
d['selected']=1
ampm.append(d)

diff --git a/plone/app/form/widgets/datecomponents.txt b/plone/app/form/widgets/datecomponents.txt
index 4595df6..0499260 100644
--- a/plone/app/form/widgets/datecomponents.txt
+++ b/plone/app/form/widgets/datecomponents.txt
@@ -158,6 +158,23 @@ test is run.
>>> parseDate(parts)
(2499, '12', '31', '00', '00')

+Now testing if Python env localization will not affects the AM/PM behavior of the
+view (preventing regression of issue https://github.com/plone/plone.app.form/issues/8).
+The EN_us locale will not suffer of the issue while other (DE_de or IT_it) do.
+
+ >>> import locale
+ >>> default_locale = locale.getlocale()
+ >>> testdate = DateTime.DateTime('2015/04/17 09:00:00')
+ >>> locale.setlocale(locale.LC_ALL, "EN_us")
+ 'EN_us'
+ >>> view.result(testdate, use_ampm=True)['ampm']
+ [{'selected': None, 'id': '--', 'value': 'AM'}, {'selected': 1, 'id': 'AM', 'value': 'AM'}, {'selected': None, 'id': 'PM', 'value': 'PM'}]
+ >>> locale.setlocale(locale.LC_ALL, "IT_it")
+ 'IT_it'
+ >>> view.result(testdate, use_ampm=True)['ampm']
+ [{'selected': None, 'id': '--', 'value': 'AM'}, {'selected': 1, 'id': 'AM', 'value': 'AM'}, {'selected': None, 'id': 'PM', 'value': 'PM'}]
+ >>> dummy = locale.setlocale(locale.LC_ALL, default_locale)
+
un-monkey patch
>>> DateTime.DateTime.localZone = realLocalZone
>>> datecomponents.PLONE_CEILING = DateTime.DateTime(2500, 0)


Repository: plone.app.form
Branch: refs/heads/2.2.x
Date: 2015-04-17T15:13:30+02:00
Author: Luca Fabbri (keul) <luca@keul.it>
Commit: https://github.com/plone/plone.app.form/commit/cbe7093f9a300ab33e48c7c52890c215a5ca7fa2

Updated CHANGES

Files changed:
M CHANGES.txt
M setup.py

diff --git a/CHANGES.txt b/CHANGES.txt
index 3b3c81b..1ba121b 100644
index 9d67f5c..b03e330 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,7 +1,7 @@
Changelog
=========

-4.1.5 (unreleased)
+4.1.5 (2015-04-26)
@@ -4,7 +4,9 @@ Changelog
2.2.5 (unreleased)
------------------

- In searchForMembers, ensure that request parameters are properly
diff --git a/setup.py b/setup.py
index c771f01..8b89f06 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-- Nothing changed yet.
+- Preventing AM/PM issue when some locales are set.
+ This fix https://github.com/plone/plone.app.form/issues/8
+ [keul]

-version = '4.1.5.dev0'
+version = '4.1.5'

setup(name='Products.PlonePAS',
version=version,
2.2.4 (2014-01-27)


Repository: plone.app.form
Branch: refs/heads/2.2.x
Date: 2015-04-26T20:41:23+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.form/commit/da0259af9b40544d8fd4f3db54e1151717219f6c

Repository: Products.PlonePAS
Branch: refs/heads/4.1.x
Date: 2015-04-26T12:47:07-04:00
Author: esteele (esteele) <eric@esteele.net>
Commit: https://github.com/plone/Products.PlonePAS/commit/9b5b123581f32eab8e1a85d7934ff6213557705b
Merge pull request #10 from plone/issue-8-localization

Back to development: 4.1.6
Issue 8 localization

Files changed:
M CHANGES.txt
M setup.py
M plone/app/form/widgets/datecomponents.py
M plone/app/form/widgets/datecomponents.txt

diff --git a/CHANGES.txt b/CHANGES.txt
index 1ba121b..bdea0c9 100644
index 9d67f5c..b03e330 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,12 @@
Changelog
=========

+4.1.6 (unreleased)
+------------------
+
+- Nothing changed yet.
+
+
4.1.5 (2015-04-26)
@@ -4,7 +4,9 @@ Changelog
2.2.5 (unreleased)
------------------

diff --git a/setup.py b/setup.py
index 8b89f06..e995fbb 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-- Nothing changed yet.
+- Preventing AM/PM issue when some locales are set.
+ This fix https://github.com/plone/plone.app.form/issues/8
+ [keul]

-version = '4.1.5'
+version = '4.1.6.dev0'

setup(name='Products.PlonePAS',
version=version,
2.2.4 (2014-01-27)
diff --git a/plone/app/form/widgets/datecomponents.py b/plone/app/form/widgets/datecomponents.py
index f61c0ee..177c4b7 100644
--- a/plone/app/form/widgets/datecomponents.py
+++ b/plone/app/form/widgets/datecomponents.py
@@ -215,7 +215,7 @@ def result(self, date=None,

for x in ('AM', 'PM'):
d={'id': x, 'value': x, 'selected': None}
- if x==p and not default:
+ if x==p.upper() and not default:
d['selected']=1
ampm.append(d)

diff --git a/plone/app/form/widgets/datecomponents.txt b/plone/app/form/widgets/datecomponents.txt
index 4595df6..0499260 100644
--- a/plone/app/form/widgets/datecomponents.txt
+++ b/plone/app/form/widgets/datecomponents.txt
@@ -158,6 +158,23 @@ test is run.
>>> parseDate(parts)
(2499, '12', '31', '00', '00')

+Now testing if Python env localization will not affects the AM/PM behavior of the
+view (preventing regression of issue https://github.com/plone/plone.app.form/issues/8).
+The EN_us locale will not suffer of the issue while other (DE_de or IT_it) do.
+
+ >>> import locale
+ >>> default_locale = locale.getlocale()
+ >>> testdate = DateTime.DateTime('2015/04/17 09:00:00')
+ >>> locale.setlocale(locale.LC_ALL, "EN_us")
+ 'EN_us'
+ >>> view.result(testdate, use_ampm=True)['ampm']
+ [{'selected': None, 'id': '--', 'value': 'AM'}, {'selected': 1, 'id': 'AM', 'value': 'AM'}, {'selected': None, 'id': 'PM', 'value': 'PM'}]
+ >>> locale.setlocale(locale.LC_ALL, "IT_it")
+ 'IT_it'
+ >>> view.result(testdate, use_ampm=True)['ampm']
+ [{'selected': None, 'id': '--', 'value': 'AM'}, {'selected': 1, 'id': 'AM', 'value': 'AM'}, {'selected': None, 'id': 'PM', 'value': 'PM'}]
+ >>> dummy = locale.setlocale(locale.LC_ALL, default_locale)
+
un-monkey patch
>>> DateTime.DateTime.localZone = realLocalZone
>>> datecomponents.PLONE_CEILING = DateTime.DateTime(2500, 0)


0 comments on commit a433216

Please sign in to comment.