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

2008-10-14 Thread Tres Seaver
-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  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://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-

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


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

2008-10-14 Thread Andreas Jung

On 14.10.2008 19:03 Uhr, Tres Seaver wrote:

-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.


Depends on which Python versions we want/must support for the future. 
One option would to jump on Python 2.6 for the next releases (skipping 
Python 2.5 and dropping Python 2.4 support).


Andreas
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd.  Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )