diff --git a/README.rst b/README.rst index b34289a..73e0bf3 100644 --- a/README.rst +++ b/README.rst @@ -592,4 +592,4 @@ Screenshots Compatibility ------------- * Python: 2.7, pypy, 3.4, 3.5, 3.6, pypy3 -* Django: 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10 +* Django: 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11 diff --git a/dbmail/__init__.py b/dbmail/__init__.py index c95d3be..da91b0a 100644 --- a/dbmail/__init__.py +++ b/dbmail/__init__.py @@ -4,7 +4,7 @@ import sys -VERSION = (2, 3, 18) +VERSION = (2, 3, 18, 2) default_app_config = 'dbmail.apps.DBMailConfig' diff --git a/dbmail/management/commands/dbmail_test_send.py b/dbmail/management/commands/dbmail_test_send.py index aed8a24..463aea3 100644 --- a/dbmail/management/commands/dbmail_test_send.py +++ b/dbmail/management/commands/dbmail_test_send.py @@ -19,16 +19,15 @@ def send_test_msg(pk, email, user=None, **kwargs): class Command(BaseCommand): - option_list = BaseCommand.option_list + ( - optparse.make_option('--email', dest='email', help='Recipients'), - optparse.make_option('--pk', dest='pk', help='DBMail template id'), - optparse.make_option('--without-celery', action='store_true', - default=False, dest='celery', - help='Send direct message'), - optparse.make_option('--provider', dest='provider', help='Provider'), - optparse.make_option( - '--backend', dest='backend', help='Backend', default='mail'), - ) + def add_arguments(self, parser): + parser.add_argument('--email', default='localhost', help='Recipients') + parser.add_argument('--pk', default=1, help='DBMail template id') + parser.add_argument('--without-celery', + action='store_true', + default=False, dest='celery', + help='Send direct message') + parser.add_argument('--provider', help='Provider') + parser.add_argument('--backend', help='Backend') @staticmethod def get_kwargs(options): diff --git a/dbmail/providers/apple/apns.py b/dbmail/providers/apple/apns.py index a0545b8..80e13e7 100644 --- a/dbmail/providers/apple/apns.py +++ b/dbmail/providers/apple/apns.py @@ -55,6 +55,7 @@ def send(token_hex, message, **kwargs): token_length_bin = pack('>H', len(token)) payload_length_bin = pack('>H', len(payload)) zero_byte = bytes('\0', 'utf-8') if PY3 is True else '\0' + payload = bytes(payload, 'utf-8') if PY3 is True else payload notification = ( zero_byte + token_length_bin + token + payload_length_bin + payload) diff --git a/dbmail/providers/boxcar/push.py b/dbmail/providers/boxcar/push.py index c69c84d..fd1c740 100644 --- a/dbmail/providers/boxcar/push.py +++ b/dbmail/providers/boxcar/push.py @@ -1,7 +1,12 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPSConnection -from urllib import urlencode + +try: + from httplib import HTTPSConnection + from urllib import urlencode +except ImportError: + from http.client import HTTPSConnection + from urllib.parse import urlencode from dbmail.providers.prowl.push import from_unicode from dbmail import get_version diff --git a/dbmail/providers/centrifugo/push.py b/dbmail/providers/centrifugo/push.py index 13c56a7..8fd2e64 100644 --- a/dbmail/providers/centrifugo/push.py +++ b/dbmail/providers/centrifugo/push.py @@ -1,10 +1,16 @@ # -*- encoding: utf-8 -*- +try: + from urllib2 import urlopen, Request + from urllib import urlencode +except ImportError: + from urllib.request import urlopen, Request + from urllib.parse import urlencode + import hmac from hashlib import sha256 from json import dumps -from urllib import urlencode -from urllib2 import urlopen, Request + from django.conf import settings diff --git a/dbmail/providers/google/android.py b/dbmail/providers/google/android.py index 48b1d54..801d893 100644 --- a/dbmail/providers/google/android.py +++ b/dbmail/providers/google/android.py @@ -1,9 +1,13 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPSConnection -from json import dumps, loads -from urlparse import urlparse +try: + from httplib import HTTPSConnection + from urlparse import urlparse +except ImportError: + from http.client import HTTPSConnection + from urllib.parse import urlparse +from json import dumps, loads from django.conf import settings diff --git a/dbmail/providers/http/push.py b/dbmail/providers/http/push.py index f13750e..436d548 100644 --- a/dbmail/providers/http/push.py +++ b/dbmail/providers/http/push.py @@ -1,7 +1,12 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPConnection, HTTPSConnection -from urlparse import urlparse +try: + from httplib import HTTPConnection, HTTPSConnection + from urlparse import urlparse +except ImportError: + from http.client import HTTPSConnection, HTTPConnection + from urllib.parse import urlparse + from json import dumps from django.conf import settings diff --git a/dbmail/providers/iqsms/sms.py b/dbmail/providers/iqsms/sms.py index 953f419..b4248df 100644 --- a/dbmail/providers/iqsms/sms.py +++ b/dbmail/providers/iqsms/sms.py @@ -1,7 +1,12 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPConnection -from urllib import urlencode +try: + from httplib import HTTPConnection + from urllib import urlencode +except ImportError: + from http.client import HTTPConnection + from urllib.parse import urlencode + from base64 import b64encode from django.conf import settings diff --git a/dbmail/providers/parse_com/push.py b/dbmail/providers/parse_com/push.py index 6e92e60..0db4b9d 100644 --- a/dbmail/providers/parse_com/push.py +++ b/dbmail/providers/parse_com/push.py @@ -1,6 +1,10 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPSConnection +try: + from httplib import HTTPSConnection +except ImportError: + from http.client import HTTPSConnection + from json import dumps, loads from django.conf import settings diff --git a/dbmail/providers/pushover/push.py b/dbmail/providers/pushover/push.py index db8defe..397473a 100644 --- a/dbmail/providers/pushover/push.py +++ b/dbmail/providers/pushover/push.py @@ -1,7 +1,12 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPSConnection -from urllib import urlencode +try: + from httplib import HTTPSConnection + from urllib import urlencode +except ImportError: + from http.client import HTTPSConnection + from urllib.parse import urlencode + from json import loads from django.conf import settings diff --git a/dbmail/providers/slack/push.py b/dbmail/providers/slack/push.py index b1e0cfa..ed3fd43 100644 --- a/dbmail/providers/slack/push.py +++ b/dbmail/providers/slack/push.py @@ -1,8 +1,13 @@ # -*- encoding: utf-8 -*- -from httplib import HTTPSConnection -from urllib import urlencode -from urlparse import urlparse +try: + from httplib import HTTPSConnection + from urlparse import urlparse + from urllib import urlencode +except ImportError: + from http.client import HTTPSConnection + from urllib.parse import urlparse, urlencode + from json import dumps from django.conf import settings diff --git a/dbmail/providers/twilio/sms.py b/dbmail/providers/twilio/sms.py index d542f59..936e410 100644 --- a/dbmail/providers/twilio/sms.py +++ b/dbmail/providers/twilio/sms.py @@ -1,7 +1,12 @@ # -*- coding: utf-8 -*- -from httplib import HTTPSConnection -from urllib import urlencode +try: + from httplib import HTTPSConnection + from urllib import urlencode +except ImportError: + from http.client import HTTPSConnection + from urllib.parse import urlencode + from base64 import b64encode from json import loads diff --git a/dbmail/static/dbmail/admin/js/dbmail.js b/dbmail/static/dbmail/admin/js/dbmail.js index fef1d18..465bdb4 100644 --- a/dbmail/static/dbmail/admin/js/dbmail.js +++ b/dbmail/static/dbmail/admin/js/dbmail.js @@ -2,8 +2,8 @@ $(document).ready(function () { if (document.location.href.indexOf('/add/') == -1) { if ($('#searchbar').length == 0 && $('#grp-changelist-search').length == 0) { - var test_button = '