#NEWLINE# def archive( self , cursor ) : #NEWLINE# #INDENT# 'Given a cursor, use it to archive ourself.\n\n        Archiving means changing to a random username so the username they were\n        using is released. We also sign them out.\n\n        ' #NEWLINE# self . final_check ( cursor ) #NEWLINE# def reserve( cursor , username ) : #NEWLINE# #INDENT# check = cursor . one ( '\n\n                UPDATE participants\n                   SET username=%s\n                     , username_lower=%s\n                     , claimed_time=NULL\n                     , session_token=NULL\n                     , session_expires=now()\n                     , giving = 0\n                     , taking = 0\n                 WHERE username=%s\n             RETURNING username\n\n            ' , ( username , username . lower ( ) , self . username ) , default = NotSane ) #NEWLINE# return check #NEWLINE# #UNINDENT# archived_as = safely_reserve_a_username ( cursor , reserve = reserve ) #NEWLINE# add_event ( reserve , 'participant' , dict ( id = self . id , action = 'archive' , values = dict ( new_username = archived_as , old_username = self . username ) ) ) #NEWLINE# return archived_as