#36846: ContentType.get_object_for_this_type() does not handle removed models
-------------------------------------+-------------------------------------
     Reporter:  Maarten ter Huurne   |                    Owner:  Vishy
         Type:                       |  Algo
  Cleanup/optimization               |                   Status:  closed
    Component:                       |                  Version:  dev
  contrib.contenttypes               |
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

 * resolution:   => wontfix
 * status:  assigned => closed
 * type:  Bug => Cleanup/optimization

Comment:

 Thanks for the proposal. An issue, however, is that the two failures would
 become indistinguishable. For instance, we intentionally swallow
 `ObjectNotFoundError` in `fetch_one()`:

 {{{#!py
             try:
                 rel_obj = ct.get_object_for_this_type(
                     using=instance._state.db, pk=pk_val
                 )
             except ObjectDoesNotExist:
                 pass
 }}}

 ... but I doubt we want to intentionally swallow the case where there is a
 stale content type.

 If `model_class()` let `LookupError` rise instead of returning `None`,
 we'd have something nicer, but the method is documented, so we'd need a
 deprecation cycle to change it.

 Given those reservations, I'm having a hard time seeing the value. If you
 think this is worth a deprecation cycle to change, please gather consensus
 on the [https://forum.djangoproject.com/c/internals/5 Forum (internals)]
 first. Thanks.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36846#comment:2>
Django <https://code.djangoproject.com/>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019b99e12451-82117894-effd-4457-aa55-500f77366995-000000%40eu-central-1.amazonses.com.

Reply via email to