Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2015-02-12 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by carljm):

 @jbg The main reason I can see not to add the `is_dst` argument is that
 (if you're using pytz, which you certainly should be if you care at all
 about correct timezone handling) `timezone.make_aware(value, tz)` is
 simply a different spelling of `tz.localize(value)`, and the latter is
 actually shorter, and already has the `is_dst` argument. So if you are
 using `pytz`, there's really no reason not to just use `tz.localize()`
 instead of `timezone.make_aware()`. The only real purpose of
 `timezone.make_aware()` is to offer semi-correct handling for the no-pytz
 case, and in that case I don't think there's anything sane we could do
 with the `is_dst` argument anyway.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.b4ce3e550a30f9c96068543857d4f7cc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2015-02-12 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by jbg):

 I understand the rationale for closing this but wonder whether make_aware
 could offer an is_dst option to be passed through, allowing the caller of
 make_aware to resolve the ambiguity if possible?

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.f2f0223029f4a54781748bdb1740dff4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2014-11-04 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by timgraham):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 I see this is [https://docs.djangoproject.com/en/dev/topics/i18n/timezones
 /#interpretation-of-naive-datetime-objects documented], so I think ticket
 can be closed then.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.23167b8e18e4c5c2778a4a21df9d9e0c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2014-11-04 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by aaugustin):

 Yes, the implementation was specifically designed to raise an exception on
 ambiguous inputs.

 If you have a use case where it's important to enter datetimes in the
 ambiguous period, then it's up to you to implement a widget that deals
 with the ambiguity. Django doesn't ship one because there isn't a commonly
 accepted UI for dealing with this.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.220d55efe6d51141cab08c3708dfa3ff%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2014-11-04 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by mdineen):

 Replying to [comment:2 aaugustin]:
 > This is done on purpose according to the Zen of Python: "in the face of
 ambiguity, refuse the temptation to guess."
 >
 > Celery's solution is to assume that naive datetimes are in UTC. We can't
 adopt this solution for `make_aware` because it takes a `timezone`
 argument which can have a value other than UTC.
 >
 > Always assuming the earliest date may work for your use case, but it may
 be considered a silent data corruption bug for other use cases, so it
 isn't an assumption we can enforce in the framework.

 Okay, without specifying a solution, I'd like to highlight that the line
 below causes problems every time in my code.

 https://github.com/django/django/blob/master/django/utils/timezone.py#L361

 Can be reproduced with any app using tz, admin, any date field and a date
 in the affected range.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.0079f8fcab69a3fe4e450e5d913bfa41%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2014-11-03 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+

Comment (by aaugustin):

 This is done on purpose according to the Zen of Python: "in the face of
 ambiguity, refuse the temptation to guess."

 Celery's solution is to assume that naive datetimes are in UTC. We can't
 adopt this solution for `make_aware` because it takes a `timezone`
 argument which can have a value other than UTC.

 Always assuming the earliest date may work for your use case, but it may
 be considered a silent data corruption bug for other use cases, so it
 isn't an assumption we can enforce in the framework.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.66ea162329401450d51bfed31ac250e9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23756: Fall DST change breaks timezone.py make_aware

2014-11-03 Thread Django
#23756: Fall DST change breaks timezone.py make_aware
---+
 Reporter:  mdineen|Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Utilities  |  Version:  1.7
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by timgraham):

 * needs_docs:   => 0
 * needs_better_patch:   => 0
 * easy:  1 => 0
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 There were many failures on Jenkins on November 2, e.g.
 {{{
 ==
 ERROR [0.003s]: test_different_timezones
 (utils_tests.test_timesince.TimesinceTests)
 When using two different timezones.
 --
 Traceback (most recent call last):
   File "/home/jenkins/workspace/django-
 coverage/tests/utils_tests/test_timesince.py", line 101, in
 test_different_timezones
 now_tz = timezone.make_aware(now, timezone.get_default_timezone())
   File "/home/jenkins/workspace/django-coverage/django/utils/timezone.py",
 line 361, in make_aware
 return timezone.localize(value, is_dst=None)
   File "/home/jenkins/workspace/django-
 coverage/tests/.env/local/lib/python2.7/site-packages/pytz/tzinfo.py",
 line 349, in localize
 raise AmbiguousTimeError(dt)
 AmbiguousTimeError: 2014-11-02 01:59:24.072611
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.f7e556f5d47b5e82a6a41ece31ad9f25%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.