diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-16 13:24:18 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-05-16 13:24:18 +0000 |
| commit | 1ca5bc0f0c8cf054658ef55419dc9ac0b774bcdf (patch) | |
| tree | 6e5e0e9efc2974bb8c977a75bb187ac381d2c85b | |
| parent | 0e2043deefc517baed2e58b591e1c24275dc63d7 (diff) | |
unicode: Audited comment app. Only a couple of minor changes needed.
git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5257 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/comments/feeds.py | 4 | ||||
| -rw-r--r-- | django/contrib/comments/views/comments.py | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/django/contrib/comments/feeds.py b/django/contrib/comments/feeds.py index 34cf3d9cef..2f395318b6 100644 --- a/django/contrib/comments/feeds.py +++ b/django/contrib/comments/feeds.py @@ -11,7 +11,7 @@ class LatestFreeCommentsFeed(Feed): def title(self): if not hasattr(self, '_site'): self._site = Site.objects.get_current() - return "%s comments" % self._site.name + return u"%s comments" % self._site.name def link(self): if not hasattr(self, '_site'): @@ -21,7 +21,7 @@ class LatestFreeCommentsFeed(Feed): def description(self): if not hasattr(self, '_site'): self._site = Site.objects.get_current() - return "Latest comments on %s" % self._site.name + return u"Latest comments on %s" % self._site.name def items(self): return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True)[:40] diff --git a/django/contrib/comments/views/comments.py b/django/contrib/comments/views/comments.py index d3c1d81e84..435bfa6f73 100644 --- a/django/contrib/comments/views/comments.py +++ b/django/contrib/comments/views/comments.py @@ -12,6 +12,7 @@ from django.http import HttpResponseRedirect from django.utils.text import normalize_newlines from django.conf import settings from django.utils.translation import ungettext, ugettext as _ +from django.utils.encoding import smart_unicode import base64, datetime COMMENTS_PER_PAGE = 20 @@ -248,7 +249,7 @@ def post_comment(request): # If the IP is banned, mail the admins, do NOT save the comment, and # serve up the "Thanks for posting" page as if the comment WAS posted. if request.META['REMOTE_ADDR'] in settings.BANNED_IPS: - mail_admins("Banned IP attempted to post comment", str(request.POST) + "\n\n" + str(request.META)) + mail_admins("Banned IP attempted to post comment", smart_unicode(request.POST) + "\n\n" + str(request.META)) else: manipulator.do_html2python(new_data) comment = manipulator.save(new_data) @@ -312,7 +313,7 @@ def post_free_comment(request): # serve up the "Thanks for posting" page as if the comment WAS posted. if request.META['REMOTE_ADDR'] in settings.BANNED_IPS: from django.core.mail import mail_admins - mail_admins("Practical joker", str(request.POST) + "\n\n" + str(request.META)) + mail_admins("Practical joker", smart_unicode(request.POST) + "\n\n" + str(request.META)) else: manipulator.do_html2python(new_data) comment = manipulator.save(new_data) |
