Opened 17 years ago

Closed 17 years ago

#3007 closed defect (fixed)

[patch] random.getrandbits only available in python 2.4

Reported by: raman Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: major Keywords: random mail
Cc: gary.wilson@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Changeset 4051* introduced "getrandbits"* from the "random" module.

This method is only available in python 2.4.

Django installation docs say django runs on python 2.3+. (Noticed this when a page crashed on a python 2.3 django site I was working on ...)

thanks,

raman

*http://code.djangoproject.com/changeset/4051/django/trunk

http://docs.python.org/lib/module-random.html

Attachments (1)

messageid.patch (991 bytes ) - added by Chris Beaven 17 years ago.
Fallback for Python 2.3 (and caching of server name)

Download all attachments as: .zip

Change History (4)

by Chris Beaven, 17 years ago

Attachment: messageid.patch added

Fallback for Python 2.3 (and caching of server name)

comment:1 by Chris Beaven, 17 years ago

Summary: random.getrandbits only available in python 2.4[patch] random.getrandbits only available in python 2.4

socket.getfqdn() can be mightily slow in some cases so I've changed the code so it caches the hostname. If you didn't want to slow startup down any more, it could alternatively be lazily loaded.

comment:2 by Gary Wilson <gary.wilson@…>, 17 years ago

Cc: gary.wilson@… added

comment:3 by Adrian Holovaty, 17 years ago

Resolution: fixed
Status: newclosed

(In [4058]) Fixed #3007 -- Fixed Python 2.4-ism from [4051] in django/core/mail.py. Also cached the result of socket.getfqdn(). Thanks for the patch, SmileyChris

Note: See TracTickets for help on using tickets.
Back to Top