Commit fe7a8e7ea395e34a6a962591c75eb5e71e52e570

Authored by Francisco Albarran
1 parent 45347d0a

Prevented get_current_site deprecation warning

  1 +try:
  2 + from django.contrib.sites.shortcuts import get_current_site
  3 +except ImportError:
  4 + from django.contrib.sites.models import get_current_site
... ...
1 1 from django.contrib.syndication.views import Feed
2   -from django.contrib.sites.models import get_current_site
3 2 from django.utils.translation import ugettext as _
4 3
5 4 import django_comments
6 5
  6 +from .compat import get_current_site
  7 +
7 8
8 9 class LatestCommentFeed(Feed):
9 10 """Feed of latest comments on the current site."""
... ...
... ... @@ -60,12 +60,13 @@ from django.conf import settings
60 60 from django.core.mail import send_mail
61 61 from django.db.models.base import ModelBase
62 62 from django.template import Context, loader
63   -from django.contrib.sites.models import get_current_site
64 63 from django.utils import timezone
65 64
66 65 import django_comments
67 66 from django_comments import signals
68 67
  68 +from .compat import get_current_site
  69 +
69 70
70 71 class AlreadyModerated(Exception):
71 72 """
... ...
1 1 from django.core import urlresolvers
2   -from .models import CustomComment
3 2 from .forms import CustomCommentForm
4 3
5 4
6 5 def get_model():
  6 + from .models import CustomComment
7 7 return CustomComment
8 8
9 9
... ...
... ... @@ -9,7 +9,7 @@ from django.test.utils import override_settings
9 9 from django_comments.forms import CommentForm
10 10 from django_comments.models import Comment
11 11
12   -from ..models import Article, Author
  12 +from testapp.models import Article, Author
13 13
14 14 # Shortcut
15 15 CT = ContentType.objects.get_for_model
... ...
... ... @@ -8,7 +8,7 @@ from django_comments.forms import CommentForm
8 8 from django_comments.models import Comment
9 9
10 10 from . import CommentTestCase
11   -from ..models import Article
  11 +from testapp.models import Article
12 12
13 13
14 14 class CommentFormTests(CommentTestCase):
... ...
... ... @@ -8,7 +8,7 @@ from django_comments.moderation import (moderator, CommentModerator,
8 8 AlreadyModerated)
9 9
10 10 from . import CommentTestCase
11   -from ..models import Entry
  11 +from testapp.models import Entry
12 12
13 13
14 14 class EntryModerator1(CommentModerator):
... ...
... ... @@ -9,7 +9,7 @@ from django_comments import signals
9 9 from django_comments.models import Comment
10 10
11 11 from . import CommentTestCase
12   -from ..models import Article, Book
  12 +from testapp.models import Article, Book
13 13
14 14
15 15 post_redirect_re = re.compile(r'^http://testserver/posted/\?c=(?P<pk>\d+$)')
... ...
... ... @@ -9,7 +9,7 @@ from django.contrib.sites.models import Site
9 9 from django_comments.models import Comment
10 10
11 11 from . import CommentTestCase
12   -from ..models import Article
  12 +from testapp.models import Article
13 13
14 14
15 15 class CommentFeedTests(CommentTestCase):
... ...
... ... @@ -3,7 +3,7 @@ from __future__ import absolute_import
3 3 from django_comments.models import Comment
4 4
5 5 from . import CommentTestCase
6   -from ..models import Author, Article
  6 +from testapp.models import Author, Article
7 7
8 8
9 9 class CommentModelTests(CommentTestCase):
... ...
... ... @@ -7,7 +7,7 @@ from django.template.base import libraries
7 7 from django_comments.forms import CommentForm
8 8 from django_comments.models import Comment
9 9
10   -from ..models import Article, Author
  10 +from testapp.models import Article, Author
11 11 from . import CommentTestCase
12 12
13 13 register = Library()
... ...
... ... @@ -5,6 +5,8 @@ envlist = py26-django16, py27-django16, py32-django16, py33-django16,
5 5
6 6 [testenv]
7 7 commands = {envpython} setup.py test
  8 +setenv=
  9 + PYTHONWARNINGS=default
8 10
9 11 [testenv:py26-django16]
10 12 basepython = python2.6
... ...
Please register or login to post a comment