Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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

Attachments (1)

Screen Shot 2014-11-18 at 3.33.52 PM.png (74.4 KB ) - added by Nikolas N 9 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by Baptiste Mispelon, 9 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

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.

comment:2 by Claude Paroz, 9 years ago

from django.utils.version import get_major_version :-)

in reply to:  2 comment:3 by Baptiste Mispelon, 9 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 Claude Paroz, 9 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 Bibhas C Debnath, 9 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.

Last edited 9 years ago by Bibhas C Debnath (previous) (diff)

comment:6 by Tim Graham, 9 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 Bibhas C Debnath, 9 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 Claude Paroz, 9 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 Bibhas C Debnath, 9 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 Claude Paroz, 9 years ago

The url change could/should be handled by a compatibility redirect, as mentioned by Tim in comment:6.

comment:11 by Claude Paroz, 9 years ago

I've just added the redirect for short-term resolution of the issue. Code still needs to be updated.

comment:12 by Tim Graham, 9 years ago

Component: DocumentationCore (Other)
Severity: Release blockerNormal
Summary: Broken link on 403 forbidden "CSRF token missing or incorrect." pageMake documentation links in error messages consistent
Type: BugCleanup/optimization
Version: 1.7master

comment:13 by Tim Graham, 9 years ago

Has patch: set
Keywords: csrf removed
Triage Stage: AcceptedReady for checkin

comment:14 by Claude Paroz <claude@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 234a2e0b6bcad5536d5d6cbb398eb6b7cc4eb67e:

Fixed #23866 -- Harmonized refs to Django documentation from code

comment:15 by Claude Paroz <claude@…>, 9 years ago

In ffa548fb561d4e32b42566cc67a2499a5e321944:

Updated link to CSRF docs

Refs #23866.

Note: See TracTickets for help on using tickets.
Back to Top