Updates to support Python 3

This commit is contained in:
Isaac Bythewood
2017-09-23 21:12:54 +00:00
parent 7bd6b48d7c
commit c71fa17aca
3 changed files with 7 additions and 4 deletions

View File

@@ -33,7 +33,6 @@ class PinryAuthorization(DjangoAuthorization):
if klass is False:
raise Unauthorized("You are not allowed to access that resource.")
print dir(klass._meta)
permission = '%s.delete_%s' % (klass._meta.app_label, klass._meta.model_name)
if not bundle.request.user.has_perm(permission, bundle.obj):

View File

@@ -1,5 +1,9 @@
import requests
from cStringIO import StringIO
try:
from cStringIO import StringIO
except ImportError: # Python 3 support
from io import StringIO
from django.conf import settings
from django.core.files.uploadedfile import InMemoryUploadedFile

View File

@@ -6,7 +6,7 @@ from django.contrib.auth.models import User as BaseUser
class User(BaseUser):
@property
def gravatar(self):
return hashlib.md5(self.email).hexdigest()
return hashlib.md5(self.email.encode('utf-8')).hexdigest()
class Meta:
proxy = True
proxy = True