Пример #1
0
    def sync_repository_onaccept(form):
        """
            Send registration request to the peer
        """

        try:
            repository_id = form.vars.id
        except:
            return

        sync = current.sync

        if repository_id:
            rtable = current.s3db.sync_repository
            query = (rtable.id == repository_id)
            repository = current.db(query).select(limitby=(0, 1)).first()
            if repository and repository.url:
                from s3.s3sync import S3SyncRepository
                connector = S3SyncRepository.factory(repository)
                success = connector.register()
                if not success:
                    current.response.warning = \
                        current.T("Could not auto-register at the repository, please register manually.")
                else:
                    current.response.confirmation = \
                        current.T("Successfully registered at the repository.")
        return
Пример #2
0
    def sync_repository_onaccept(form):
        """
            Send registration request to the peer
        """

        try:
            repository_id = form.vars.id
        except:
            return

        sync = current.sync

        if repository_id:
            rtable = current.s3db.sync_repository
            query = (rtable.id == repository_id)
            repository = current.db(query).select(limitby=(0, 1)).first()
            if repository and repository.url:
                from s3.s3sync import S3SyncRepository
                connector = S3SyncRepository(repository)
                success = connector.register()
                if not success:
                    current.response.warning = \
                        current.T("Could not auto-register at the repository, please register manually.")
                else:
                    current.response.confirmation = \
                        current.T("Successfully registered at the repository.")
        return