Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2019-06-05 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  admin, descriptor,   | Triage Stage:  Accepted
  system, checks, framework, |
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by felixxm):

 Thanks for the report, I added a separate ticket #30543 for this issue.

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2019-06-04 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  admin, descriptor,   | Triage Stage:  Accepted
  system, checks, framework, |
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by ajcsimons):

 Unfortuantely this fix causes other bugs:
 1. if hasattr(obj.model, item) returns false then we go straight to the
 else clause which returns the error,
 2. whereas before the else clause did another check for
 model._meta.get_field(item) and would only return the error if that raised
 a FieldDoesNotExist exception
 3. So how is it that hasattr(model, item) can return false, but
 model._meta.get_field(item) will return something meaning the check should
 not return an error?
 4. Answer: the field is a special one which is only valid to access on
 instances of the model (whose ModelAdmin we are verifying) and not the
 model class itself. An example of this is the PositionField from the
 django-positions library (which inherits from djangos
 models.IntegerField):
 {{{
 def __get__(self, instance, owner):
 if instance is None:
 raise AttributeError("%s must be accessed via instance." %
 self.name)
 current, updated = getattr(instance, self.get_cache_name())
 return current if updated is None else updated
 }}}

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2017-10-03 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  admin, descriptor,   | Triage Stage:  Accepted
  system, checks, framework, |
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Hunter Richards):

 Thanks for the help and review, Tim!

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2017-10-02 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  admin, descriptor,   | Triage Stage:  Accepted
  system, checks, framework, |
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

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


Comment:

 In [changeset:"47016adbf54b54143d4cf052eeb29fc72d27e6b1" 47016adb]:
 {{{
 #!CommitTicketReference repository=""
 revision="47016adbf54b54143d4cf052eeb29fc72d27e6b1"
 Fixed #28490 -- Removed unused code in admin.E108 check.
 }}}

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2017-09-25 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  admin, descriptor,   | Triage Stage:  Accepted
  system, checks, framework, |
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted


Comment:

 I think it would be fine to do the simplification but I'd omit the test
 for a broken descriptor that returns `None`.

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2017-08-24 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  admin, descriptor,   | Triage Stage:
  system, checks, framework, |  Unreviewed
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Hunter Richards):

 Thanks for the reply, Tim!

 I can't think of a use case for a Descriptor that returns `None` that
 triggers the error reported here, but the Descriptor API makes it very
 easy to shoot yourself in the foot by writing one, and the Python
 Descriptor documentation includes many examples that would trigger this
 error, along with no word on having to manually handle the `if obj is
 None` case (although the `@property` example is correctly written):

 https://docs.python.org/3/howto/descriptor.html

 We initially discovered this bug due to such an improperly written
 Descriptor, and it took us a long time to track down the reason due to the
 triggering of the error message being so deep.  We wanted to save other
 Djangonauts that time in the future!

 Might I also point out that this PR includes a simplification of the
 affected Admin Check code, including the removal of a known code
 duplication, regardless of the prevalence of `None`-returning Descriptors.

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2017-08-24 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  admin, descriptor,   | Triage Stage:
  system, checks, framework, |  Unreviewed
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 What's the use case for a descriptor returning `None`?

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


Re: [Django] #28490: Descriptors on Models are reported as nonexistent by System Check Framework for ModelAdmin.list_display if they return None

2017-08-12 Thread Django
#28490: Descriptors on Models are reported as nonexistent by System Check 
Framework
for ModelAdmin.list_display if they return None
-+-
 Reporter:  Hunter Richards  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.admin|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  admin, descriptor,   | Triage Stage:
  system, checks, framework, |  Unreviewed
  validation |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Hunter Richards):

 * Attachment "modeladmin_none_descriptor_error.diff" added.


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