(self)
| 46 | return {} |
| 47 | |
| 48 | def create(self): |
| 49 | # Because a cache can fail silently (e.g. memcache), we don't know if |
| 50 | # we are failing to create a new session because of a key collision or |
| 51 | # because the cache is missing. So we try for a (large) number of times |
| 52 | # and then raise an exception. That's the risk you shoulder if using |
| 53 | # cache backing. |
| 54 | for i in range(10000): |
| 55 | self._session_key = self._get_new_session_key() |
| 56 | try: |
| 57 | self.save(must_create=True) |
| 58 | except CreateError: |
| 59 | continue |
| 60 | self.modified = True |
| 61 | return |
| 62 | raise RuntimeError( |
| 63 | "Unable to create a new session key. " |
| 64 | "It is likely that the cache is unavailable." |
| 65 | ) |
| 66 | |
| 67 | async def acreate(self): |
| 68 | for i in range(10000): |
no test coverage detected