summaryrefslogtreecommitdiffstats
path: root/django_authopenid
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2009-07-10 19:11:34 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2009-07-10 19:11:34 -0400
commitbb801f2bbd9f26bebca846b71e8947a1951f86a5 (patch)
treecd4f7417cdbabc6834aeb45f73f09208a738ac2d /django_authopenid
parentd3b7efc1eba6f38fba8d5110c7155f477d1459e6 (diff)
downloadaskbot-bb801f2bbd9f26bebca846b71e8947a1951f86a5.tar.gz
askbot-bb801f2bbd9f26bebca846b71e8947a1951f86a5.tar.bz2
askbot-bb801f2bbd9f26bebca846b71e8947a1951f86a5.zip
english translation
Diffstat (limited to 'django_authopenid')
-rw-r--r--django_authopenid/forms.py18
-rw-r--r--django_authopenid/models.py4
-rw-r--r--django_authopenid/util.py4
3 files changed, 13 insertions, 13 deletions
diff --git a/django_authopenid/forms.py b/django_authopenid/forms.py
index 9c519d74..09fa76b1 100644
--- a/django_authopenid/forms.py
+++ b/django_authopenid/forms.py
@@ -155,11 +155,11 @@ class OpenidRegisterForm(forms.Form):
""" test if username is valid and exist in database """
if 'username' in self.cleaned_data:
if not username_re.search(self.cleaned_data['username']):
- raise forms.ValidationError(u"用户名只能包含英文字母、数字和下划线")
+ raise forms.ValidationError(_('invalid user name'))
if self.cleaned_data['username'] in RESERVED_NAMES:
- raise forms.ValidationError(u'对不起,您不能注册该用户名,请换一个试试')
+ raise forms.ValidationError(_('sorry, this name can not be used, please try another'))
if len(self.cleaned_data['username']) < 3:
- raise forms.ValidationError(u'用户名太短,请使用三个或三个以上字符')
+ raise forms.ValidationError(_('username too short'))
try:
user = User.objects.get(
username__exact = self.cleaned_data['username']
@@ -167,8 +167,8 @@ class OpenidRegisterForm(forms.Form):
except User.DoesNotExist:
return self.cleaned_data['username']
except User.MultipleObjectsReturned:
- raise forms.ValidationError(u'该用户名已被注册,请换一个试试')
- raise forms.ValidationError(u'该用户名已被注册,请换个试试')
+ raise forms.ValidationError(_('this name is already in use - please try anoter'))
+ raise forms.ValidationError(_('this name is already in use - please try anoter'))
def clean_email(self):
"""For security reason one unique email in database"""
@@ -250,13 +250,13 @@ class RegistrationForm(forms.Form):
required=False)
username = forms.CharField(max_length=30,
widget=forms.TextInput(attrs=attrs_dict),
- label=u'Username')
+ label=_('choose a username'))
email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,
- maxlength=200)), label=u'Email address')
+ maxlength=200)), label=_('your email address'))
password1 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict),
- label=u'Password')
+ label=_('choose password'))
password2 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict),
- label=u'Password (again, to catch typos)')
+ label=_('retype password'))
def clean_username(self):
"""
diff --git a/django_authopenid/models.py b/django_authopenid/models.py
index e6fb8111..9826c452 100644
--- a/django_authopenid/models.py
+++ b/django_authopenid/models.py
@@ -3,7 +3,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
-import hashlib, random, sys, os, time
+import md5, random, sys, os, time
__all__ = ['Nonce', 'Association', 'UserAssociation',
'UserPasswordQueueManager', 'UserPasswordQueue']
@@ -47,7 +47,7 @@ class UserPasswordQueueManager(models.Manager):
# The random module is seeded when this Apache child is created.
# Use SECRET_KEY as added salt.
while 1:
- confirm_key = hashlib.md5("%s%s%s%s" % (
+ confirm_key = md5.new("%s%s%s%s" % (
random.randint(0, sys.maxint - 1), os.getpid(),
time.time(), settings.SECRET_KEY)).hexdigest()
try:
diff --git a/django_authopenid/util.py b/django_authopenid/util.py
index 54c1246b..841a81c7 100644
--- a/django_authopenid/util.py
+++ b/django_authopenid/util.py
@@ -15,7 +15,7 @@ try:
except:
from yadis import xri
-import time, base64, hashlib, operator
+import time, base64, md5, operator
import urllib
from models import Association, Nonce
@@ -128,7 +128,7 @@ class DjangoOpenIDStore(OpenIDStore):
def getAuthKey(self):
# Use first AUTH_KEY_LEN characters of md5 hash of SECRET_KEY
- return hashlib.md5(settings.SECRET_KEY).hexdigest()[:self.AUTH_KEY_LEN]
+ return md5.new(settings.SECRET_KEY).hexdigest()[:self.AUTH_KEY_LEN]
def isDumb(self):
return False