def logon(self, username, password):
if self._token:<EOL><INDENT>self.logoff()<EOL><DEDENT>try:<EOL><INDENT>response = self.__makerequest(<EOL>'<STR_LIT>', email=username, password=password)<EOL><DEDENT>except FogBugzAPIError:<EOL><INDENT>e = sys.exc_info()[<NUM_LIT:1>]<EOL>raise FogBugzLogonError(e)<EOL><DEDENT>self._token = response.token.string<EOL>if type(self._token) == CData:<EOL><INDENT>self._token = self._token.encode('<STR_LIT:utf-8>')<EOL><DEDENT>
Logs the user on to FogBugz.

Returns None for a successful login.