Changeset: 58f8cb504db9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=58f8cb504db9
Modified Files:
        python/monetdb/mapi2.py
        python/monetdb/mapi3.py
Branch: Oct2010
Log Message:

Delay import of crypt module until needed.
The default Python installation on Windows does not include crypt,
but with this change we can still use the monetdb.mapi module
(as long as there is no need for crypt authentication).


diffs (38 lines):

diff -r 9f6b7511cfbc -r 58f8cb504db9 python/monetdb/mapi2.py
--- a/python/monetdb/mapi2.py   Tue Sep 21 12:42:52 2010 +0200
+++ b/python/monetdb/mapi2.py   Tue Sep 21 16:34:52 2010 +0200
@@ -25,7 +25,6 @@
 import logging
 import struct
 import hashlib
-import crypt
 import platform
 
 from cStringIO import StringIO
@@ -207,6 +206,7 @@
             m.update(salt.encode())
             pwhash = "{MD5}" + m.hexdigest()
         elif "crypt" in h:
+            import crypt
             pwhash = "{crypt}" + crypt.crypt((password+salt)[:8], salt[-2:])
         else:
             pwhash = "{plain}" + password + salt
diff -r 9f6b7511cfbc -r 58f8cb504db9 python/monetdb/mapi3.py
--- a/python/monetdb/mapi3.py   Tue Sep 21 12:42:52 2010 +0200
+++ b/python/monetdb/mapi3.py   Tue Sep 21 16:34:52 2010 +0200
@@ -25,7 +25,6 @@
 import logging
 import struct
 import hashlib
-import crypt
 import platform
 
 from io import BytesIO
@@ -207,6 +206,7 @@
             m.update(salt.encode())
             pwhash = "{MD5}" + m.hexdigest()
         elif "crypt" in h:
+            import crypt
             pwhash = "{crypt}" + crypt.crypt((password+salt)[:8], salt[-2:])
         else:
             pwhash = "{plain}" + password + salt
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to