Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug

2021-07-31 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Chris Jerdonek):

 For future reference, it turns out the bug fixed by this ticket was
 previously mentioned here, but never opened as a separate ticket:
 https://code.djangoproject.com/ticket/21905#comment:19

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.8027a3d3f78cf04aa707d5eeac185c86%40djangoproject.com.


Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug

2021-07-30 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | 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 Mariusz Felisiak ):

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


Comment:

 In [changeset:"542e74947535b10684e9e396a0d54979e9f70fbf" 542e7494]:
 {{{
 #!CommitTicketReference repository=""
 revision="542e74947535b10684e9e396a0d54979e9f70fbf"
 Fixed #32966 -- Fixed TimeField.check() crash for timezone-aware times in
 default when USE_TZ = True.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.9f8e25412d6ea04d747a3386b1531524%40djangoproject.com.


Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug

2021-07-30 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"6f5e07a84d65496abcdb876170c513c4a3840760" 6f5e07a8]:
 {{{
 #!CommitTicketReference repository=""
 revision="6f5e07a84d65496abcdb876170c513c4a3840760"
 Refs #32966 -- Refactored out DateTimeCheckMixin._check_if_value_fixed().
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.23c117b6e3bac4a06cb2cf55dc8872fc%40djangoproject.com.


Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug

2021-07-30 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"6fa5d05dbaf8d7ed9ce9026202d6f8fb350fa5c4" 6fa5d05d]:
 {{{
 #!CommitTicketReference repository=""
 revision="6fa5d05dbaf8d7ed9ce9026202d6f8fb350fa5c4"
 Refs #32966 -- Simplified the _check_fix_default_value() implementations.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.94a06f6f8cfcc6aa8f73a3ba822d2a61%40djangoproject.com.


Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug

2021-07-30 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"eebebfe0a98897d55480016b3b822df60883bed9" eebebfe0]:
 {{{
 #!CommitTicketReference repository=""
 revision="eebebfe0a98897d55480016b3b822df60883bed9"
 Refs #32966 -- Added _to_naive() and _get_naive_now() for use in
 DateTimeCheckMixin classes.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.91b73123b91bcce0ddf3d8dcd20bd574%40djangoproject.com.


Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug

2021-07-30 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | 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 Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.308a5f4dbfabe07487698fa5927f6f23%40djangoproject.com.


Re: [Django] #32966: Time-related _check_fix_default_value() methods can be optimized / simplified and have a bug (was: time-related _check_fix_default_value() methods can be optimized / simplified)

2021-07-29 Thread Django
#32966: Time-related _check_fix_default_value() methods can be optimized /
simplified and have a bug
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.aa556ed790f10571620101d532ff3aed%40djangoproject.com.


Re: [Django] #32966: time-related _check_fix_default_value() methods can be optimized / simplified

2021-07-29 Thread Django
#32966: time-related _check_fix_default_value() methods can be optimized /
simplified
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Chris Jerdonek):

 * has_patch:  0 => 1


Comment:

 PR: https://github.com/django/django/pull/14717

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.c1b6b989070039755150f8db4ac3678c%40djangoproject.com.


Re: [Django] #32966: time-related _check_fix_default_value() methods can be optimized / simplified

2021-07-28 Thread Django
#32966: time-related _check_fix_default_value() methods can be optimized /
simplified
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 |  Jerdonek
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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 Chris Jerdonek):

 * type:  Cleanup/optimization => Bug


Comment:

 When I started looking at this, I noticed there is a bug on this line:
 
https://github.com/django/django/blob/fe074c96a343530beea50fbdd0803d3e7b739e8e/django/db/models/fields/__init__.py#L2216

 It can be triggered by the following when `USE_TZ = True`:

 {{{#!python
 from django.db import models
 import django.utils.timezone as timezone

 class MyModel(models.Model):
 tz = models.TimeField(default=timezone.now().timetz())

 class Meta:
 app_label = 'test'

 field = MyModel._meta.get_field('tz')
 field.check()
 }}}

 It results in:

 {{{
 Traceback (most recent call last):
   File "", line 1, in 
   File "/.../django/db/models/fields/__init__.py", line 1112, in check
 *self._check_fix_default_value(),
   File "/.../django/db/models/fields/__init__.py", line 2220, in
 _check_fix_default_value
 if lower <= value <= upper:
 TypeError: '<=' not supported between instances of 'datetime.datetime' and
 'datetime.time'
 }}}

 This case is not covered in the tests here:
 
https://github.com/django/django/blob/fe074c96a343530beea50fbdd0803d3e7b739e8e/tests/invalid_models_tests/test_ordinary_fields.py#L743-L750

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.5a1f2f4f976901bdecd39af8a18594a4%40djangoproject.com.


Re: [Django] #32966: time-related _check_fix_default_value() methods can be optimized / simplified

2021-07-27 Thread Django
#32966: time-related _check_fix_default_value() methods can be optimized /
simplified
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 Type:   |  Jerdonek
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 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 Mariusz Felisiak):

 * stage:  Unreviewed => Accepted


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.dce35f9eb78af8c244cc22463af17fad%40djangoproject.com.


Re: [Django] #32966: time-related _check_fix_default_value() methods can be optimized / simplified (was: time-related _check_fix_default_value() methods can be simplified)

2021-07-27 Thread Django
#32966: time-related _check_fix_default_value() methods can be optimized /
simplified
-+-
 Reporter:  Chris Jerdonek   |Owner:  Chris
 Type:   |  Jerdonek
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.a396b0ae9e96788660ec240532d4cfc6%40djangoproject.com.