Skip to content

Commit

Permalink
Merge pull request #256 from streeter/ignore-sites-framework
Browse files Browse the repository at this point in the history
Only import django.contrib.sites if it is required
  • Loading branch information
paltman authored Jul 28, 2016
2 parents cb7ccde + b9d9a11 commit 5b3ec94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pinax/stripe/hooks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django.core.mail import EmailMessage
from django.template.loader import render_to_string

from django.contrib.sites.models import Site


class DefaultHookSet(object):

Expand Down Expand Up @@ -30,6 +28,9 @@ def trial_period(self, user, plan):
def send_receipt(self, charge):
from django.conf import settings
if not charge.receipt_sent:
# Import here to not add a hard dependency on the Sites framework
from django.contrib.sites.models import Site

site = Site.objects.get_current()
protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
ctx = {
Expand Down
4 changes: 2 additions & 2 deletions pinax/stripe/tests/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from django.template.loader import render_to_string
from django.utils import timezone

from django.contrib.sites.models import Site

from ..hooks import DefaultHookSet


Expand Down Expand Up @@ -34,6 +32,8 @@ def trial_period(self, user, plan):

def send_receipt(self, charge):
if not charge.receipt_sent:
from django.contrib.sites.models import Site

site = Site.objects.get_current()
protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
ctx = {
Expand Down

0 comments on commit 5b3ec94

Please sign in to comment.