Commit 98b133a2 authored by fred's avatar fred

use django.utils.six for cookielib/urllib/urllib2 modules

parent f45bf81f
......@@ -4,9 +4,6 @@ import email
import hashlib
import random
import socket
import urllib
import urllib2
import cookielib
import datetime
from django.conf import settings
......@@ -15,7 +12,10 @@ from django.core.urlresolvers import reverse_lazy
from django.db import models, IntegrityError
from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from django.utils.http import urlencode
from django.utils.translation import ugettext as _
import django.utils.six.moves.urllib as urllib2
import django.utils.six.moves.http_cookiejar as cookielib
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.detail import DetailView
......@@ -69,12 +69,12 @@ def unsubscription(request) :
cookie_jar = cookielib.CookieJar()
url_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
login_params = urllib.urlencode({'email' : subscriber.email, 'password' : subscriber.password})
login_params = urlencode({'email' : subscriber.email, 'password' : subscriber.password})
login_request = urllib2.Request(settings.NEWSLETTER_UNSUBSCRIPTION_URL, login_params)
url = url_opener.open(login_request)
unsubscribe_action_url = ("%s/%s" % (settings.NEWSLETTER_UNSUBSCRIPTION_URL, subscriber.email))
unsubscribe_params = urllib.urlencode({'unsub' : 'Résilier', 'unsubconfirm' : '1'})
unsubscribe_params = urlencode({'unsub' : 'Résilier', 'unsubconfirm' : '1'})
unsubscribe_request = urllib2.Request(unsubscribe_action_url, unsubscribe_params)
url = url_opener.open(unsubscribe_request)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment