[Django] #30299: Update AJAX Documentation getCookie Implementation

4 views
Skip to first unread message

Django

unread,
Mar 28, 2019, 10:12:29 AM3/28/19
to django-...@googlegroups.com
#30299: Update AJAX Documentation getCookie Implementation
-------------------------------------+-------------------------------------
Reporter: Matthew | Owner: nobody
Pava |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 2.1
Documentation | Keywords: ajax jquery
Severity: Normal | getCookie
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
The Django docs provide a very nice function to obtain the session cookie,
but it depends on jQuery being installed.

The code is here:
https://docs.djangoproject.com/en/2.1/ref/csrf/#ajax

We should remove the dependency on jQuery, and it looks like there's only
one line that needs to be updated.
Replace
`var cookie = jQuery.trim(cookies[i]);`
with
`var cookie = cookies[i].trim();`

str.trim() is [https://caniuse.com/#search=trim supported] in every modern
browser.

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

Django

unread,
Mar 28, 2019, 7:55:31 PM3/28/19
to django-...@googlegroups.com
#30299: Remove jQuery dependency from getCookie() function in CSRF docs
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 2.1
Severity: Normal | Resolution:
Keywords: ajax jquery | Triage Stage: Ready for
getCookie | checkin
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Ready for checkin


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

Django

unread,
Mar 28, 2019, 8:00:06 PM3/28/19
to django-...@googlegroups.com
#30299: Remove jQuery dependency from getCookie() function in CSRF docs
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: 2.1
Severity: Normal | Resolution: fixed

Keywords: ajax jquery | Triage Stage: Ready for
getCookie | checkin
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"ffdacc5879fcfb5b1857340ac874314de9aa490e" ffdacc58]:
{{{
#!CommitTicketReference repository=""
revision="ffdacc5879fcfb5b1857340ac874314de9aa490e"
[2.2.x] Fixed #30299 -- Removed jQuery dependency from getCookie() in CSRF
docs.

Backport of 8e675e2bd8366adf5d0b579accfef75a7b1bc3bf from master
}}}

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

Django

unread,
Mar 28, 2019, 8:00:07 PM3/28/19
to django-...@googlegroups.com
#30299: Remove jQuery dependency from getCookie() function in CSRF docs
-------------------------------------+-------------------------------------
Reporter: Matthew Pava | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 2.1
Severity: Normal | Resolution: fixed
Keywords: ajax jquery | Triage Stage: Ready for
getCookie | checkin
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"8e675e2bd8366adf5d0b579accfef75a7b1bc3bf" 8e675e2b]:
{{{
#!CommitTicketReference repository=""
revision="8e675e2bd8366adf5d0b579accfef75a7b1bc3bf"


Fixed #30299 -- Removed jQuery dependency from getCookie() in CSRF docs.
}}}

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

Reply all
Reply to author
Forward
0 new messages