Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
melbic committed Jan 6, 2015
1 parent 5de33e5 commit 9119fb1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Empty file added __init__.py
Empty file.
2 changes: 1 addition & 1 deletion django_scarface/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# coding=utf-8
from local import *
from .local import *
2 changes: 1 addition & 1 deletion django_scarface/settings/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from local import *
from .local import *
from os.path import join

SOUTH_TESTS_MIGRATE = False
Expand Down
10 changes: 5 additions & 5 deletions scarface/management/commands/extract_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re

regex = re.compile(
ur'(?P<cert>-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----).*(?P<key>-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----)',
u'(?P<cert>-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----).*(?P<key>-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----)',
re.IGNORECASE | re.MULTILINE | re.UNICODE | re.DOTALL)


Expand Down Expand Up @@ -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))
2 changes: 1 addition & 1 deletion scarface/models.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
8 changes: 4 additions & 4 deletions scarface/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 9119fb1

Please sign in to comment.