aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jm2l/models.py12
-rw-r--r--jm2l/upload.py2
2 files changed, 7 insertions, 7 deletions
diff --git a/jm2l/models.py b/jm2l/models.py
index 0bc212c..54acdf3 100644
--- a/jm2l/models.py
+++ b/jm2l/models.py
@@ -161,14 +161,14 @@ class User(Base):
@property
def my_hash(self):
m = hashlib.sha1()
- m.update("Nobody inspects ")
+ m.update("Nobody inspects ".encode('utf-8'))
if self.nom:
- m.update(unicode.encode(self.nom,'utf8'))
+ m.update(self.nom.encode('utf-8'))
if self.pseudo:
- m.update(unicode.encode(self.pseudo,'utf8'))
- if self.prenom:
- m.update(unicode.encode(self.prenom,'utf8'))
- m.update(" the spammish repetition")
+ m.update(self.pseudo.encode('utf-8'))
+ if self.prenom:
+ m.update(self.prenom.encode('utf-8'))
+ m.update(" the spammish repetition".encode('utf-8'))
return m.hexdigest()
@property
diff --git a/jm2l/upload.py b/jm2l/upload.py
index 22281b8..551eb27 100644
--- a/jm2l/upload.py
+++ b/jm2l/upload.py
@@ -134,7 +134,7 @@ class MediaUpload(MediaPath):
def validate(self, result, filecontent):
# let's say we don't trust the uploader
- RealMime = magic.from_buffer( filecontent.read(1024), mime=True)
+ RealMime = magic.from_buffer( filecontent.read(1024), mime=True).decode('utf-8')
filecontent.seek(0)
if RealMime!=result['type']:
result['error'] = 'l\'extension du fichier ne correspond pas à son contenu - '