Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jazzband/django-cookie-consent
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: 9mido/django-cookie-consent
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Jul 27, 2020

  1. Update util.py

    9mido authored Jul 27, 2020
    Copy the full SHA
    d4749b5 View commit details
  2. Update cookie_consent_tags.py

    9mido authored Jul 27, 2020
    Copy the full SHA
    edc21ce View commit details
Showing with 12 additions and 6 deletions.
  1. +7 −4 cookie_consent/templatetags/cookie_consent_tags.py
  2. +5 −2 cookie_consent/util.py
11 changes: 7 additions & 4 deletions cookie_consent/templatetags/cookie_consent_tags.py
Original file line number Diff line number Diff line change
@@ -107,10 +107,13 @@ def get_decline_cookie_groups_cookie_string(request, cookie_groups):
"""
Tag returns decline cookie string suitable to use in javascript.
"""
cookie_dic = get_cookie_dict_from_request(request)
for cookie_group in cookie_groups:
cookie_dic[cookie_group.varname] = settings.COOKIE_CONSENT_DECLINE
return get_cookie_string(cookie_dic)
try:
cookie_dic = get_cookie_dict_from_request(request)
for cookie_group in cookie_groups:
cookie_dic[cookie_group.varname] = settings.COOKIE_CONSENT_DECLINE
return get_cookie_string(cookie_dic)
except:
pass


@register.simple_tag
7 changes: 5 additions & 2 deletions cookie_consent/util.py
Original file line number Diff line number Diff line change
@@ -33,8 +33,11 @@ def dict_to_cookie_str(dic):


def get_cookie_dict_from_request(request):
cookie_str = request.COOKIES.get(settings.COOKIE_CONSENT_NAME)
return parse_cookie_str(cookie_str)
try:
cookie_str = request.COOKIES.get(settings.COOKIE_CONSENT_NAME)
return parse_cookie_str(cookie_str)
except:
pass


def set_cookie_dict_to_response(response, dic):