Kelvin Wong  committed 29324ce Draft

Remove stripws function and use method chaining of builtin strip function

  • Participants
  • Parent commits eff3042
  • Branches default

Comments (0)

Files changed (1)

File django_scrypt/

 """Create and store Scrypt message digests
 from __future__ import unicode_literals
-import re
 import sys
 from django.contrib.auth.hashers import BasePasswordHasher, mask_hash
 from django.utils.datastructures import SortedDict
     if PYTHON3:
         if type(s) is bytes:
-            return stripws(s.decode('utf-8'))
+            return s.decode('utf-8').strip()
-            return stripws(s)
+            return s.strip()
         if type(s) is unicode:
-            return stripws(s.encode('utf-8'))
+            return s.encode('utf-8').strip()
-            return stripws(str(s))
+            return str(s).strip()
 class ScryptPasswordHasher(BasePasswordHasher):
         assert encoded
-        encoded = stripws(encoded)
+        encoded = encoded.strip()
         algorithm, salt, Nexp, r, p, buflen, h = encoded.split('$')
         assert algorithm == self.algorithm
         # TODO: buflen is an experimental proposal in py-scrypt