#16727: contrib.contenttypes.views.shortcut error
-----------------------+--------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: contrib.contenttypes
Version: 1.3 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------+--------------------------------------
There is a problem during absurl processing:
{{{#!python
absurl = obj.get_absolute_url()
if absurl.startswith('http://') or absurl.startswith('https://'):
return http.HttpResponseRedirect(absurl)
else:
...
}}}
So, if get_absolute_url returns '//sub.example.com/entry.html' shortcut
view will return something like
'http://example.com//sub.example.com/entry.html'
This problem was founded with help of django_hosts application. Author of
this app decided to return urls without 'http:' or 'https:' prefix. Here
is the explanation:
The double slash at the beginning of the href is an easy way to not
have to worry about which scheme (http or https) is used. Your browser
will automatically choose the currently used scheme. If you're on
https://mysite.com/ a link with an href of //mysite.com/about/ would
actually point to https://mysite.com/about/. For more information see the
The protocol-relative URL article by Paul Irish or the appropriate section
in RFC 3986.
I think the better way is urlparse lib using to decide on the url kind.
--
Ticket URL: <https://code.djangoproject.com/ticket/16727>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.