Django

Code

Ticket #3604 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

Use hashlib if running under Python 2.5

Reported by: Rob Hudson <treborhudson@gmail.com> Assigned to: nobody
Milestone: Component: Admin interface
Version: SVN Keywords: hashlib, sha1, md5, sprintsept14
Cc: treborhudson@gmail.com Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

This was discussed here: http://groups.google.com/group/django-developers/browse_thread/thread/d5f0951f47889770/4cb8257b8d4d8c28

Python 2.5 has deprecated the use of the sha1 and md5 modules in favor of the hashlib module. A patch will be following that implements django.contrib.auth.models methods using hashlib.

Attachments

hashlib.diff (2.7 kB) - added by Rob Hudson <treborhudson@gmail.com> on 02/28/07 11:33:27.

Change History

02/28/07 11:33:27 changed by Rob Hudson <treborhudson@gmail.com>

  • attachment hashlib.diff added.

02/28/07 11:34:55 changed by Rob Hudson <treborhudson@gmail.com>

  • cc set to treborhudson@gmail.com.
  • needs_better_patch changed.
  • has_patch set to 1.
  • needs_tests changed.
  • needs_docs changed.

02/28/07 16:15:56 changed by Simon G. <dev@simon.net.nz>

  • keywords set to hashlib, sha1, md5.
  • stage changed from Unreviewed to Accepted.

09/15/07 08:59:06 changed by Fredrik Lundh <fredrik@pythonware.com>

  • keywords changed from hashlib, sha1, md5 to hashlib, sha1, md5, sprintsept14.
  • stage changed from Accepted to Ready for checkin.

Possible change: instead of doing

    try:
        # Python 2.5 has moved to using hashlib for hashing functions
        import hashlib
        ... use hashlib
    except ImportError:
        ... use old libraries

do

    try:
        # Python 2.5 has moved to using hashlib for hashing functions
        import hashlib
    except ImportError:
        # Fallback
        ... use old libraries ...
    else:
        ... use hashlib ...

Also, this test lacks explicit tests, but I think the functionality should be covered by other existing tests.

09/15/07 13:46:24 changed by adrian

  • needs_better_patch set to 1.

I'm working on checking this in.

09/15/07 14:45:34 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

(In [6318]) Fixed #3604 -- django.contrib.auth password checking now uses hashlib if it's available. Thanks, Rob Hudson


Add/Change #3604 (Use hashlib if running under Python 2.5)




Change Properties
Action