1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

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
This commit is contained in:
Malcolm Tredinnick 2007-05-16 13:24:18 +00:00
parent 0e2043deef
commit 1ca5bc0f0c
2 changed files with 5 additions and 4 deletions

View File

@ -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]

View File

@ -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)