def register(self):
        """
            Register this site at the peer repository

            @return: True to indicate success, otherwise False
        """

        repository = self.repository

        if not repository.url:
            return True

        current.log.debug((repository.url) % "S3Sync: register at %s")

        # Construct the URL
        config = repository.config
        url = "%s/sync/repository/register.xml?repository=%s" % \
              (repository.url, config.uuid)

        current.log.debug("S3Sync: send registration to URL %s" % url)

        # Generate the request
        req = urllib2.Request(url=url)
        handlers = []

        # Proxy handling
        proxy = repository.proxy or config.proxy or None
        if proxy:
            proxy_handler = urllib2.ProxyHandler({"http": proxy})
            handlers.append(proxy_handler)

        # Authentication
        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)

        # Install all handlers
        if handlers:
            opener = urllib2.build_opener(*handlers)
            urllib2.install_opener(opener)

        # Execute the request
        log = repository.log
        success = True
        remote = False
        try:
            f = urllib2.urlopen(req)
        except urllib2.HTTPError, e:
            result = log.FATAL
            remote = True # Peer error
            code = e.code
            message = e.read()
            success = False
            try:
                message_json = json.loads(message)
                message = message_json.get("message", message)
            except:
                pass
        except:
            result = log.FATAL
            code = 400
            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 the operation
        log.write(repository_id=repository.id,
                  transmission=log.OUT,
                  mode=log.PUSH,
                  action="request registration",
                  remote=remote,
                  result=result,
                  message=message,
                  )

        return success

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3/sync_adapter/eden.py/S3SyncAdapter.register/swapped operands of `%`