#23866 closed Cleanup/optimization (fixed)
Make documentation links in error messages consistent
Reported by: | Nikolas Nyby | 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)
Changed 9 years ago by
Attachment: | Screen Shot 2014-11-18 at 3.33.52 PM.png added |
---|
comment:1 Changed 9 years ago by
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:2 follow-up: 3 Changed 9 years ago by
from django.utils.version import get_major_version
:-)
comment:3 Changed 9 years ago by
Replying to claudep:
from django.utils.version import get_major_version
:-)
That would help, yes. But not for the development version though :)
comment:4 Changed 9 years ago by
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 Changed 9 years ago by
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 Changed 9 years ago by
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 Changed 9 years ago by
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 Changed 9 years ago by
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 Changed 9 years ago by
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 Changed 9 years ago by
The url change could/should be handled by a compatibility redirect, as mentioned by Tim in comment:6.
comment:11 Changed 9 years ago by
I've just added the redirect for short-term resolution of the issue. Code still needs to be updated.
comment:12 Changed 9 years ago by
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 Changed 9 years ago by
Has patch: | set |
---|---|
Keywords: | csrf removed |
Triage Stage: | Accepted → Ready for checkin |
comment:14 Changed 9 years ago by
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.