'Register this site at the peer repository
@return: True to indicate success, otherwise False'

def register(self):

    repository = self.repository
    if (not repository.url):
        return True
    url = ('%s/sync/repository/register.json' % repository.url)
    current.log.debug(('S3Sync:    register    at    %s' % url))
    config = repository.config
    name = current.deployment_settings.get_base_public_url().split('//', 1)[1]
    parameters = {'uuid': config.uuid, 'name': name, 'apitype': 'eden'}
    data = json.dumps(parameters)
    headers = {'Content-Type': 'application/json'}
    req = urllib2.Request(url=url, headers=headers)
    handlers = []
    proxy = (repository.proxy or config.proxy or None)
    if proxy:
        proxy_handler = urllib2.ProxyHandler({'http': proxy})
        handlers.append(proxy_handler)
    username = repository.username
    password = repository.password
    if (username and password):
        import base64
        base64string = base64.encodestring(('%s:%s' % (username, password)))[:(-1)]
        req.add_header('Authorization', ('Basic    %s' % base64string))
        passwd_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
        passwd_manager.add_password(realm=None, uri=url, user=username, passwd=password)
        auth_handler = urllib2.HTTPBasicAuthHandler(passwd_manager)
        handlers.append(auth_handler)
    if handlers:
        opener = urllib2.build_opener(*handlers)
        urllib2.install_opener(opener)
    log = repository.log
    success = True
    remote = False
    try:
        f = urllib2.urlopen(req, data)
    except urllib2.HTTPError as e:
        result = log.FATAL
        remote = True
        message = e.read()
        success = False
        try:
            message_json = json.loads(message)
            message = message_json.get('message', message)
        except:
            pass
    except:
        result = log.FATAL
        message = sys.exc_info()[1]
        success = False
    else:
        ruid = None
        message = f.read()
        try:
            message_json = json.loads(message)
            message = message_json.get('message', message)
            ruid = message_json.get('sender', None)
        except:
            message = 'Registration    successful'
        result = log.SUCCESS
        if (ruid is not None):
            db = current.db
            rtable = current.s3db.sync_repository
            try:
                db((rtable.id == repository.id)).update(uuid=ruid)
            except:
                pass
    log.write(repository_id=repository.id, transmission=log.OUT, mode=log.PUSH, action='request    registration', remote=remote, result=result, message=message)
    return success
