Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2019-03-07 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"d5276398046ce4a102776a1e67dcac2884d80dfe" d527639]:
 {{{
 #!CommitTicketReference repository=""
 revision="d5276398046ce4a102776a1e67dcac2884d80dfe"
 Fixed #29754 -- Added is_dst parameter to Trunc database functions.
 }}}

-- 
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/066.5524132f7628b81165b1dfc1c3d6a7cc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2019-03-03 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * stage:  Accepted => Ready for checkin


Comment:

 PR LGTM except for the `versionchanged` and release notes that were
 targeting 2.2 but this can be adjusted by the committers.

 Thanks for the work and discussion Alexander. If you want to discuss
 making `is_dst` default to `False` I suggest you discuss it on the
 developer mailing list where you'd likely to attract much more feedback
 from the community than this ticket tracker. Thanks!

-- 
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/066.0a0f13bf1b58140c4c575338eab7c46e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2019-03-02 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alexander Holmbäck):

 * needs_better_patch:  1 => 0


Comment:

 Ok I agree with that.

 [https://github.com/django/django/pull/10390 PR] is ready for review.

-- 
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/066.6615aeeda96a8a2be7c8df1cb6e4df55%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2019-02-19 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 In my opinion we should being by landing a patch to allows passing
 `is_dst` and discussing changing the default value to `False` for both
 this function and `make_aware` should be discussed in another ticket.

-- 
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/066.a49128d680f986b0a7470640754fe3f5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2018-09-19 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alexander Holmbäck):

 * needs_better_patch:  0 => 1


Comment:

 Ok I'v been digging a bit deeper into this, here's a recap and a few
 proposals.

 When `make_aware()` is fed a datetime that isn't valid in the current
 timezone, it convert it to standard time if `is_dst=False` and daylight
 saving time if `is_dst=True`. If `is_dst=None`, which is default, it
 raises an exception. All this seems reasonable, it departs from `pytz`
 default which is to convert the invalid datetime to normal time, but
 that's justifieable and well
 
[https://docs.djangoproject.com/en/2.1/ref/utils/#django.utils.timezone.make_aware
 documented].

 In the case of `Trunc()` however, having `make_aware()` raise an excpetion
 when a truncated date is invalid is overly drastic. Hence, the current
 patch introduces a new optional flag `is_dst` to `TruncBase()` so that
 developers can decide for themselves how invalid times should be treated.
 But the consequences of not setting that flag can be dire and predicting
 those consequences would be difficult for all but the must timezone savvy
 developers (I know I wouldn't).

 That said, I've been thinking about alternative solutions.

 1) Pass `is_dst=False` to `make_aware()`. This would resonate with the
 behavior of `pytz` but it covers up invalid datetimes and a developer
 would need to re-localize them to know which datetime is valid and which
 isn't. I's also odd to explicitly choose standard time for an invalid
 datetime, even if that's what `pytz` does.

 2) Keep invalid datetimes naive. This would make invalid datetimes easier
 to distinguish from valid datetimes but as they are naive they wouldn't
 always behave like aware datetimes which could cause other problems down
 the line.

 3) Create a subclass from `pytz.tzinfo.DstTzInfo` called
 `InvalidDstTzInfo` and attach that to `tzinfo` for invalid dates. This
 would make invalid datetimes behave just like valid datetimes but also
 easy to recognize. This could be neat but it entangles django's `timezone`
 functionality with `pytz` in ways that will make it more difficult to
 maintain.

 I'm leaning slightly towards the first alternative. If we want to help
 developers checking for invalid dates we could do as `dateutil` does and
 provide `timezone.datetime_ambiguous(dt)` and
 `timezone.datetime_exists(dt)` as helper functions.

 Thoughts?

-- 
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/066.afce1bdc8aa67bd41c9aa24ded2af20e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2018-09-17 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 Alexander, I think this should be handled in a separate ticket.

-- 
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/066.bc8148dcf5d9c1196f86eefa4197686b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2018-09-17 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Alexander Holmbäck):

 Should
 https://docs.djangoproject.com/en/2.1/ref/models/querysets/#datetimes also
 take  a `tz_info`?

-- 
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/066.99ef0e82ed89ab686b04f984a22fd527%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2018-09-14 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alexander Holmbäck):

 * needs_better_patch:  1 => 0
 * needs_docs:  1 => 0


-- 
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/066.67d9f8cf4bdab10361ea75469397748e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2018-09-14 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  Alexander
 |  Holmbäck
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alexander Holmbäck):

 * owner:  nobody => Alexander Holmbäck
 * status:  new => assigned


-- 
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/066.d12e6d040648fdb2bad18b2179a5171c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError

2018-09-14 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * needs_better_patch:  0 => 1
 * needs_docs:  0 => 1


-- 
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/066.e81bca142bca553adbcb29693c7d5f30%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29754: Trunc() should allow passing is_dst resolution to avoid NonExistentTimeError/AmbiguousTimeError (was: Trunc() doesn't handle NonExistentTimeError/AmbiguousTimeError)

2018-09-14 Thread Django
#29754: Trunc() should allow passing is_dst resolution to avoid
NonExistentTimeError/AmbiguousTimeError
-+-
 Reporter:  Alexander Holmbäck   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  pytz, Trunc, is_dst  | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * keywords:  pytz, Trunc() => pytz, Trunc, is_dst
 * has_patch:  0 => 1
 * stage:  Unreviewed => Accepted
 * type:  Bug => New feature


Comment:

 Accepting on the basis that allowing to pass `is_dst=(True|False)` to
 `Trunc` and friends is a feature request analogous to #22598.

-- 
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/066.8a6e00108e6da16f422911e6bddb9a2b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.