소스 검색

The ``crypt`` module is only present on Unix, import if needed

Guillaume Ayoub 16 년 전
부모
커밋
5d81889a4f
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      radicale/acl/htpasswd.py

+ 2 - 1
radicale/acl/htpasswd.py

@@ -28,7 +28,6 @@ supported, but md5 is not (see ``htpasswd`` man page to understand why).
 """
 
 import base64
-import crypt
 import hashlib
 
 from radicale import config
@@ -45,6 +44,8 @@ def _plain(hash_value, password):
 
 def _crypt(hash_value, password):
     """Check if ``hash_value`` and ``password`` match using crypt method."""
+    # The ``crypt`` module is only present on Unix, import if needed
+    import crypt
     return crypt.crypt(password, hash_value) == hash_value