Code

Opened 7 years ago

Closed 7 years ago

#3007 closed defect (fixed)

[patch] random.getrandbits only available in python 2.4

Reported by: raman Owned by: adrian
Component: Core (Other) Version: master
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: UI/UX:

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 SmileyChris 7 years ago.
Fallback for Python 2.3 (and caching of server name)

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by SmileyChris

Fallback for Python 2.3 (and caching of server name)

comment:1 Changed 7 years ago by SmileyChris

  • Summary changed from random.getrandbits only available in python 2.4 to [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 Changed 7 years ago by Gary Wilson <gary.wilson@…>

  • Cc gary.wilson@… added

comment:3 Changed 7 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.