[Django] #26978: Improve the message attached to the 404 raised by get_object_or_404 and get_list_or_404

4 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Django

ungelesen,
01.08.2016, 06:37:4701.08.16
an django-...@googlegroups.com
#26978: Improve the message attached to the 404 raised by get_object_or_404 and
get_list_or_404
---------------------------------+------------------------------
Reporter: ewjoachim | Owner:
Type: Uncategorized | Status: new
Component: Error reporting | Version: 1.9
Severity: Normal | Keywords: 404, object_name
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------
== The problem : ==

If no object is returned by get_object_or_404 and get_list_or_404, they
raise an Http404 error for which the error message contains the
{{{model._meta.object_name}}}. This name should not really be shown to the
user within the normal workflow. Classes have a {{{ verbose_name }}} that
is more appropriate.

Moreover, this message should be translatable.

(not sure if it's really a bug or a feature...)

== Code : ==

https://github.com/django/django/blob/64aba7a8aba06b8be52a1a099b44e1d3be4bdd26/django/shortcuts.py#L93

--
Ticket URL: <https://code.djangoproject.com/ticket/26978>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

ungelesen,
01.08.2016, 06:47:5401.08.16
an django-...@googlegroups.com
#26978: Improve the message attached to the 404 raised by get_object_or_404 and
get_list_or_404
----------------------------------+--------------------------------------

Reporter: ewjoachim | Owner:
Type: Uncategorized | Status: new
Component: Error reporting | Version: 1.9
Severity: Normal | Resolution:

Keywords: 404, object_name | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by ewjoachim):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> == The problem : ==
>
> If no object is returned by get_object_or_404 and get_list_or_404, they
> raise an Http404 error for which the error message contains the
> {{{model._meta.object_name}}}. This name should not really be shown to
> the user within the normal workflow. Classes have a {{{ verbose_name }}}
> that is more appropriate.
>
> Moreover, this message should be translatable.
>
> (not sure if it's really a bug or a feature...)
>
> == Code : ==
>
> https://github.com/django/django/blob/64aba7a8aba06b8be52a1a099b44e1d3be4bdd26/django/shortcuts.py#L93

New description:

== The problem : ==

If no object is returned by get_object_or_404 and get_list_or_404, they
raise an Http404 error for which the error message contains the
{{{model._meta.object_name}}}. This name should not really be shown to the
user within the normal workflow. Classes have a {{{ verbose_name }}} that
is more appropriate.

Moreover, this message should be translatable.

(not sure if it's really a bug report or a feature request...)

== Code : ==

https://github.com/django/django/blob/64aba7a8aba06b8be52a1a099b44e1d3be4bdd26/django/shortcuts.py#L93

--

--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:1>

Django

ungelesen,
01.08.2016, 19:02:0201.08.16
an django-...@googlegroups.com
#26978: Improve the message attached to the 404 raised by get_object_or_404 and
get_list_or_404
-------------------------------------+-------------------------------------
Reporter: ewjoachim | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:

Keywords: 404, object_name | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* owner: => nobody
* component: Error reporting => Core (Other)
* type: Uncategorized => Cleanup/optimization


Comment:

Is the idea that these messages might be user-facing since #24733?

--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:2>

Django

ungelesen,
03.08.2016, 16:37:5503.08.16
an django-...@googlegroups.com
#26978: Improve the message attached to the 404 raised by get_object_or_404 and
get_list_or_404
-------------------------------------+-------------------------------------
Reporter: ewjoachim | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution:
Keywords: 404, object_name | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by ewjoachim):

I just realized (and tested) that the message of the Http404 was actually
never shown by default. And for #24733, the fact that the view can have
access to the exception does not make its message user facing. If
developers decide to copy exception message to their pages, that's their
responsability.

I might have been a little too fast in opening the ticket. Sorry for the
noise.

--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:3>

Django

ungelesen,
03.08.2016, 16:38:3403.08.16
an django-...@googlegroups.com
#26978: Improve the message attached to the 404 raised by get_object_or_404 and
get_list_or_404
-------------------------------------+-------------------------------------
Reporter: ewjoachim | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Other) | Version: 1.9
Severity: Normal | Resolution: invalid

Keywords: 404, object_name | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ewjoachim):

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


--
Ticket URL: <https://code.djangoproject.com/ticket/26978#comment:4>

Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten