Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #17457 -- Marked strings used in hash descriptions for translat…

…ion.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17270 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d72c0bdc46a97c53d5e60b7e373d2f8e24673bb1 1 parent fe876f0
Aymeric Augustin authored December 24, 2011
4  django/contrib/auth/forms.py
@@ -4,7 +4,7 @@
4 4
 from django.utils.encoding import smart_str
5 5
 from django.utils.http import int_to_base36
6 6
 from django.utils.safestring import mark_safe
7  
-from django.utils.translation import ugettext_lazy as _
  7
+from django.utils.translation import ugettext, ugettext_lazy as _
8 8
 
9 9
 from django.contrib.auth import authenticate
10 10
 from django.contrib.auth.models import User
@@ -36,7 +36,7 @@ def render(self, name, value, attrs):
36 36
 
37 37
         summary = ""
38 38
         for key, value in hasher.safe_summary(encoded).iteritems():
39  
-            summary += "<strong>%(key)s</strong>: %(value)s " % {"key": key, "value": value}
  39
+            summary += "<strong>%(key)s</strong>: %(value)s " % {"key": ugettext(key), "value": value}
40 40
 
41 41
         return mark_safe("<div%(attrs)s>%(summary)s</div>" % {"attrs": flatatt(final_attrs), "summary": summary})
42 42
 
33  django/contrib/auth/hashers.py
@@ -7,6 +7,7 @@
7 7
 from django.core.exceptions import ImproperlyConfigured
8 8
 from django.utils.crypto import (
9 9
     pbkdf2, constant_time_compare, get_random_string)
  10
+from django.utils.translation import ugettext_noop as _
10 11
 
11 12
 
12 13
 UNUSABLE_PASSWORD = '!'  # This will never be a valid encoded hash
@@ -212,10 +213,10 @@ def safe_summary(self, encoded):
212 213
         algorithm, iterations, salt, hash = encoded.split('$', 3)
213 214
         assert algorithm == self.algorithm
214 215
         return SortedDict([
215  
-            ('algorithm', algorithm),
216  
-            ('iterations', iterations),
217  
-            ('salt', mask_hash(salt)),
218  
-            ('hash', mask_hash(hash)),
  216
+            (_('algorithm'), algorithm),
  217
+            (_('iterations'), iterations),
  218
+            (_('salt'), mask_hash(salt)),
  219
+            (_('hash'), mask_hash(hash)),
219 220
         ])
220 221
 
221 222
 
@@ -263,10 +264,10 @@ def safe_summary(self, encoded):
263 264
         assert algorithm == self.algorithm
264 265
         salt, checksum = data[:22], data[22:]
265 266
         return SortedDict([
266  
-            ('algorithm', algorithm),
267  
-            ('work factor', work_factor),
268  
-            ('salt', mask_hash(salt)),
269  
-            ('checksum', mask_hash(checksum)),
  267
+            (_('algorithm'), algorithm),
  268
+            (_('work factor'), work_factor),
  269
+            (_('salt'), mask_hash(salt)),
  270
+            (_('checksum'), mask_hash(checksum)),
270 271
         ])
271 272
 
272 273
 
@@ -292,9 +293,9 @@ def safe_summary(self, encoded):
292 293
         algorithm, salt, hash = encoded.split('$', 2)
293 294
         assert algorithm == self.algorithm
294 295
         return SortedDict([
295  
-            ('algorithm', algorithm),
296  
-            ('salt', mask_hash(salt, show=2)),
297  
-            ('hash', mask_hash(hash)),
  296
+            (_('algorithm'), algorithm),
  297
+            (_('salt'), mask_hash(salt, show=2)),
  298
+            (_('hash'), mask_hash(hash)),
298 299
         ])
299 300
 
300 301
 
@@ -321,8 +322,8 @@ def verify(self, password, encoded):
321 322
 
322 323
     def safe_summary(self, encoded):
323 324
         return SortedDict([
324  
-            ('algorithm', self.algorithm),
325  
-            ('hash', mask_hash(encoded, show=3)),
  325
+            (_('algorithm'), self.algorithm),
  326
+            (_('hash'), mask_hash(encoded, show=3)),
326 327
         ])
327 328
 
328 329
 
@@ -355,8 +356,8 @@ def safe_summary(self, encoded):
355 356
         algorithm, salt, data = encoded.split('$', 2)
356 357
         assert algorithm == self.algorithm
357 358
         return SortedDict([
358  
-            ('algorithm', algorithm),
359  
-            ('salt', salt),
360  
-            ('hash', mask_hash(data, show=3)),
  359
+            (_('algorithm'), algorithm),
  360
+            (_('salt'), salt),
  361
+            (_('hash'), mask_hash(data, show=3)),
361 362
         ])
362 363
 

0 notes on commit d72c0bd

Please sign in to comment.
Something went wrong with that request. Please try again.