#15639: make_random_password in django.contrib.auth.models
UserManager(models.Manager):
---------------------------+---------------------------
Reporter: anonymous | Owner: nobody
Status: new | Milestone:
Component: Uncategorized | Version: 1.2
Keywords: | Triage Stage: Unreviewed
Has patch: 0 |
---------------------------+---------------------------
make_random_password in django.contrib.auth.models
UserManager(models.Manager):
appears to use 'choice' from the python random module.
{{{
def make_random_password(self, length=10,
allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
"Generates a random password with the given length and given
allowed_chars"
# Note that default value of allowed_chars does not have "I" or
letters
# that look like it -- just to avoid confusion.
from random import choice
return ''.join([choice(allowed_chars) for i in range(length)])
}}}
I propose the following instead:
{{{
def make_random_password(self, length=10,
allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'):
"Generates a random password with the given length and given
allowed_chars"
# Note that default value of allowed_chars does not have "I" or
letters
# that look like it -- just to avoid confusion.
from random import SystemRandom as random
return ''.join([random().choice(allowed_chars) for i in
range(length)])
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/15639>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.