#23866 closed Cleanup/optimization (fixed)
Make documentation links in error messages consistent
Reported by: | Nikolas N | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
This page links to this page:
http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ref-contrib-csrf
Which is a 404. Maybe this should be:
Attachments (1)
Change History (16)
by , 10 years ago
Attachment: | Screen Shot 2014-11-18 at 3.33.52 PM.png added |
---|
comment:1 by , 10 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:3 by , 10 years ago
Replying to claudep:
from django.utils.version import get_major_version
:-)
That would help, yes. But not for the development version though :)
comment:4 by , 10 years ago
Ritgh, we'll need something a bit more elaborate, something like if 'alpha' in django.VERSION or 'beta' in django.VERSION: ver = 'stable'; else: ver = get_major_version
.
comment:5 by , 10 years ago
Looking for feedback. Is this over-engineered? https://github.com/iambibhas/django/commit/2050933081bd7b3e28817e1d883c251812b219e7
Edit: It seems I've missed rc
. Will add.
comment:6 by , 10 years ago
I think we should change the link in django/master and see if we can simply add a redirect for compatibility with older versions. I don't think generating smarts links based on the version of Django offers much benefit.
comment:7 by , 10 years ago
Right now, adding a redirect would solve the broken link issue without any code changes. I came across this when visiting the DRF doc and the url there is broken as well.
comment:8 by , 10 years ago
We already have something like that in:
https://github.com/django/django/blob/master/django/core/management/templates.py#L103
Then I've identified some locations which could benefit from a common implementation of the docs version number:
django/contrib/gis/db/models/__init__.py: "See also https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/geolibs/") django/core/management/commands/squashmigrations.py: "https://docs.djangoproject.com/en/1.7/topics/migrations/#squashing-migrations" django/core/management/sql.py: "see: https://docs.djangoproject.com/en/dev/ref/settings/#databases") django/db/migrations/state.py: "https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies " django/db/migrations/writer.py: "https://docs.djangoproject.com/en/dev/topics/migrations/#serializing-values" django/db/migrations/writer.py: "migration files.\nFor more, see https://docs.djangoproject.com/en/dev/" django/utils/deconstruct.py: "https://docs.djangoproject.com/en/dev/topics/migrations/#serializing-values" django/views/csrf.py: href='http://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ref-contrib-csrf'>Django's django/views/csrf.py: href='http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext'><code>RequestContext</code></a>
So I think that django.utils.version
could have a new get_docs_version
utility.
comment:9 by , 10 years ago
That sounds good. But how to handle the url change other than the version number e.g. in this case csrf page has moved from contrib/
?
comment:10 by , 10 years ago
The url change could/should be handled by a compatibility redirect, as mentioned by Tim in comment:6.
comment:11 by , 10 years ago
I've just added the redirect for short-term resolution of the issue. Code still needs to be updated.
comment:12 by , 10 years ago
Component: | Documentation → Core (Other) |
---|---|
Severity: | Release blocker → Normal |
Summary: | Broken link on 403 forbidden "CSRF token missing or incorrect." page → Make documentation links in error messages consistent |
Type: | Bug → Cleanup/optimization |
Version: | 1.7 → master |
comment:13 by , 10 years ago
Has patch: | set |
---|---|
Keywords: | csrf removed |
Triage Stage: | Accepted → Ready for checkin |
comment:14 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hi,
The offending line can be found here: https://github.com/django/django/blob/master/django/views/csrf.py#L69
We should also make this link https instead of just http and I'm also wondering if the link should point to the version of Django being used instead of the
dev
version (not sure how feasible that is though).I'm going to bump the severity as well since we should backport that fix.
Thanks.