diff --git a/__init__.py b/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/django_scarface/settings/__init__.py b/django_scarface/settings/__init__.py index 1eba2df..fd97ffa 100755 --- a/django_scarface/settings/__init__.py +++ b/django_scarface/settings/__init__.py @@ -1,2 +1,2 @@ # coding=utf-8 -from local import * \ No newline at end of file +from .local import * \ No newline at end of file diff --git a/django_scarface/settings/test.py b/django_scarface/settings/test.py index e708d12..9b2c6fa 100644 --- a/django_scarface/settings/test.py +++ b/django_scarface/settings/test.py @@ -1,4 +1,4 @@ -from local import * +from .local import * from os.path import join SOUTH_TESTS_MIGRATE = False diff --git a/scarface/management/commands/extract_keys.py b/scarface/management/commands/extract_keys.py index 1f564d3..0789311 100644 --- a/scarface/management/commands/extract_keys.py +++ b/scarface/management/commands/extract_keys.py @@ -9,7 +9,7 @@ import re regex = re.compile( - ur'(?P-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----).*(?P-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----)', + u'(?P-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----).*(?P-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----)', re.IGNORECASE | re.MULTILINE | re.UNICODE | re.DOTALL) @@ -40,10 +40,10 @@ def handle(self, *args, **options): if not os.path.isfile(file_name): raise CommandError(u'File "%s" does not exist'.format(file_name)) arguments = "openssl pkcs12 -nodes -in {file} -passin pass:\"{pw}\"".format(file=file_name, pw=password) - result = subprocess.check_output(arguments, shell=True) - match = re.search(regex, result) - cert_string = match.group("cert").replace("\n", "\\n") - key_string = match.group("key").replace("\n", "\\n") + result = subprocess.check_output(arguments, shell=True).decode(encoding='utf-8') + groups = re.search(regex, result).groupdict() + cert_string = groups["cert"].replace("\n", "\\n") + key_string = groups["key"].replace("\n", "\\n") self.stdout.write("Copy the following two lines to your settings file:\n\n") self.stdout.write("SCARFACE_APNS_CERTIFICATE=\"{0}\"".format(cert_string)) self.stdout.write("SCARFACE_APNS_PRIVATE_KEY=\"{0}\"".format(key_string)) \ No newline at end of file diff --git a/scarface/models.py b/scarface/models.py index 8aecb8c..dceaa11 100644 --- a/scarface/models.py +++ b/scarface/models.py @@ -1,7 +1,7 @@ from abc import ABCMeta, abstractproperty, abstractmethod import json from django.conf import settings -from utils import DefaultConnection, PushLogger, APP_PREFIX +from .utils import DefaultConnection, PushLogger, APP_PREFIX from django.db import models diff --git a/scarface/tests.py b/scarface/tests.py index 4d1bf26..c27f55a 100644 --- a/scarface/tests.py +++ b/scarface/tests.py @@ -4,12 +4,12 @@ Replace this with more appropriate tests for your application. """ -from StringIO import StringIO from boto.exception import BotoServerError from django.test import TestCase from django.test.utils import override_settings -from models import APNApplication, GCMApplication, Topic, SNSDevice, PushMessage -from utils import get_sns_connection, DefaultConnection, APP_PREFIX +from six import StringIO +from .models import APNApplication, GCMApplication, Topic, SNSDevice, PushMessage +from .utils import get_sns_connection, DefaultConnection, APP_PREFIX from django.core.management import call_command @@ -129,7 +129,7 @@ def test_add_to_app_topic(self): gcm_devices = gcm_device.platform.all_devices() apn_devices = apn_device.platform.all_devices() gcm_devices.extend(apn_devices) - self.assertEquals(len(subscriptions), len(gcm_devices)) + self.assertEqual(len(subscriptions), len(gcm_devices)) def test_send_to_topic(self): created, apn_device = self.create_apn_device()