Mercurial > p > roundup > code
comparison roundup/backends/sessions_common.py @ 6825:b04e44db7d8d
Modify unique token to use url safe characters.
Looks like the merge of the methods I chose cause url unsafe / to be
emitted sometimes. This causes poe post to fail as the url includes
the key and the / messes up the rest route url parsing code.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 07 Aug 2022 03:33:35 -0400 |
| parents | fe0091279f50 |
| children |
comparison
equal
deleted
inserted
replaced
| 6824:9811073b289e | 6825:b04e44db7d8d |
|---|---|
| 39 self.name or "basicdb" ) | 39 self.name or "basicdb" ) |
| 40 | 40 |
| 41 return self.__logger | 41 return self.__logger |
| 42 | 42 |
| 43 def getUniqueKey(self, length=40): | 43 def getUniqueKey(self, length=40): |
| 44 otk = b2s(base64.b64encode( | 44 otk = b2s(base64.urlsafe_b64encode( |
| 45 random_.token_bytes(length))).rstrip('=') | 45 random_.token_bytes(length))).rstrip('=') |
| 46 while self.exists(otk): | 46 while self.exists(otk): |
| 47 otk = b2s(base64.b64encode( | 47 otk = b2s(base64.urlsafe_b64encode( |
| 48 random_.token_bytes(length))).rstrip('=') | 48 random_.token_bytes(length))).rstrip('=') |
| 49 | 49 |
| 50 return otk | 50 return otk |
