Commits

c7protal  committed cf02d7d
  • Participants
  • Parent commits cde274f

Comments (0)

Files changed (2)

File django/contrib/comments/forms.py

 import time
 import datetime
+import sys
 
 from django import forms
 from django.forms.util import ErrorDict
 from django.conf import settings
 from django.contrib.contenttypes.models import ContentType
-from models import Comment
+from .models import Comment
 from django.utils.encoding import force_unicode
 from django.utils.hashcompat import sha_constructor
 from django.utils.text import get_text_list
     def generate_security_hash(self, content_type, object_pk, timestamp):
         """Generate a (SHA1) security hash from the provided info."""
         info = (content_type, object_pk, timestamp, settings.SECRET_KEY)
-        return sha_constructor("".join(info)).hexdigest()
+        if sys.version_info[0] < 3: 
+            return sha_constructor("".join(info)).hexdigest() 
+        else: 
+            return sha_constructor("".join(info).encode('ascii')).hexdigest() 
+
 
 class CommentDetailsForm(CommentSecurityForm):
     """

File django/core/servers/basehttp.py

         if sys.version_info < (3,0):
             assert isinstance(data, bytes), "write() argument must be string"
         else:
-            assert isinstance(data, str), "write() argument must be string"
+            assert isinstance(data, bytes), "write() argument must be string"
         
         if not self.status:
             raise AssertionError("write() before start_response()")