'Login at the peer repository
@return: None if successful, otherwise the error'

def login(self):

    _debug = current.log.debug
    _debug('S3SyncCiviCRM.login()')
    repository = self.repository
    request = {'q': 'civicrm/login', 'name': repository.username, 'pass': repository.password}
    (response, error) = self._send_request(**request)
    if error:
        _debug(('S3SyncCiviCRM.login    FAILURE:    %s' % error))
        return error
    api_key = response.findall('//api_key')
    if len(api_key):
        self.api_key = api_key[0].text
    else:
        error = 'No    API    Key    returned    by    CiviCRM'
        _debug(('S3SyncCiviCRM.login    FAILURE:    %s' % error))
        return error
    PHPSESSID = response.findall('//PHPSESSID')
    if len(PHPSESSID):
        self.PHPSESSID = PHPSESSID[0].text
    else:
        error = 'No    PHPSESSID    returned    by    CiviCRM'
        _debug(('S3SyncCiviCRM.login    FAILURE:    %s' % error))
        return error
    _debug('S3SyncCiviCRM.login    SUCCESS')
    return None
