Ticket #16182: 16182-increased-signing-precision.diff
File 16182-increased-signing-precision.diff, 925 bytes (added by , 13 years ago) |
---|
-
django/core/signing.py
159 159 160 160 class TimestampSigner(Signer): 161 161 def timestamp(self): 162 return baseconv.base62.encode(int(time.time() ))162 return baseconv.base62.encode(int(time.time() * 10000)) 163 163 164 164 def sign(self, value): 165 165 value = smart_str('%s%s%s' % (value, self.sep, self.timestamp())) … … 168 168 def unsign(self, value, max_age=None): 169 169 result = super(TimestampSigner, self).unsign(value) 170 170 value, timestamp = result.rsplit(self.sep, 1) 171 timestamp = baseconv.base62.decode(timestamp) 171 timestamp = baseconv.base62.decode(timestamp) / 10000.0 172 172 if max_age is not None: 173 173 # Check timestamp is not older than max_age 174 174 age = time.time() - timestamp