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