Skip to content

Commit

Permalink
Keep crypt context lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
kvesteri committed Oct 14, 2018
1 parent 66b88c8 commit 9c4c9df
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sqlalchemy_utils/types/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,15 @@ def __init__(self, max_length=None, **kwargs):

# Construct the passlib crypt context.
self.context = LazyCryptContext(**kwargs)
self.hashing_method = (
self._max_length = max_length

@property
def hashing_method(self):
return (
'hash'
if hasattr(self.context, 'hash')
else 'encrypt'
)
self._max_length = max_length

@property
def length(self):
Expand Down

0 comments on commit 9c4c9df

Please sign in to comment.