[Zope-dev] SVN: Zope/branches/gsoc-python-2.5/utilities/mkzopeinstance.py sha -> hashlib

Tres Seaver tseaver at palladion.com
Tue Oct 14 13:03:43 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jung wrote:
> Log message for revision 92197:
>   sha -> hashlib

That needs to be a conditional import, with a fallback to the old sha
module:  hashlib is not present in python 2.4.  E.g.:

try:
    import hashlib
except ImportError: # Python < 2.5
    import sha
    _sha = sha.new
else:
    _sha = hashlib.sha1

and then use '_sha' in the code.



Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI9NDv+gerLs4ltQ4RAuAuAJ9KX9WaftLbd1rQwCJ+JVNnA5QAeQCfTNjw
cq+cees5SixBxFY5J2SS3FI=
=PmQk
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list