def __exit__(self, exc, value, tb):
    self.testcase.user = self.old_user
    if (not self.testcase.user):
        delattr(self.testcase, 'user')
    self.testcase.client.logout()
def __exit__(self, exc, value, tb):
    self.testcase.user = self.old_user
    if (not self.testcase.user):
        delattr(self.testcase, 'user')
    self.testcase.client.logout()