Beispiel #1
0
    def setUp(self):
        super(ArchiverTestCase, self).setUp()

        handlers.celery_before_request()
        self.user = factories.UserFactory()
        self.auth = Auth(user=self.user)
        self.src = factories.NodeFactory(creator=self.user)
        self.dst = factories.RegistrationFactory(user=self.user, project=self.src, send_signals=False)
        archiver_utils.before_archive(self.dst, self.user)
        self.archive_job = self.dst.archive_job
Beispiel #2
0
    def setUp(self):
        super(ArchiverTestCase, self).setUp()

        handlers.celery_before_request()
        self.user = factories.UserFactory()
        self.auth = Auth(user=self.user)
        self.src = factories.NodeFactory(creator=self.user)
        self.dst = factories.RegistrationFactory(user=self.user, project=self.src, send_signals=False)
        archiver_utils.before_archive(self.dst, self.user)
        self.archive_job = self.dst.archive_job
Beispiel #3
0
def after_register(src, dst, user):
    """Blinker listener for registration initiations. Enqueqes a chain
    of archive tasks for the current node and its descendants

    :param src: Node being registered
    :param dst: registration Node
    :param user: registration initiator
    """
    archiver_utils.before_archive(dst, user)
    if dst.root != dst:  # if not top-level registration
        return
    archive_tasks = [archive.si(job_pk=t.archive_job._id) for t in node_and_primary_descendants(dst)]
    handlers.enqueue_task(
        celery.chain(*archive_tasks)
    )
Beispiel #4
0
def after_register(src, dst, user):
    """Blinker listener for registration initiations. Enqueqes a chain
    of archive tasks for the current node and its descendants

    :param src: Node being registered
    :param dst: registration Node
    :param user: registration initiator
    """
    archiver_utils.before_archive(dst, user)
    if dst.root != dst:  # if not top-level registration
        return
    archive_tasks = [archive.si(job_pk=t.archive_job._id) for t in node_and_primary_descendants(dst)]
    handlers.enqueue_task(
        celery.chain(*archive_tasks)
    )
Beispiel #5
0
def after_register(src, dst, user):
    """Blinker listener for registration initiations. Enqueqes a chain
    of archive tasks for the current node and its descendants

    :param src: Node being registered
    :param dst: registration Node
    :param user: registration initiator
    """
    # Prevent circular import with app.py
    from website.archiver import tasks

    archiver_utils.before_archive(dst, user)
    if dst.root != dst:  # if not top-level registration
        return
    archive_tasks = [tasks.archive(job_pk=t.archive_job._id) for t in dst.node_and_primary_descendants()]
    handlers.enqueue_task(celery.chain(archive_tasks))
Beispiel #6
0
def after_register(src, dst, user):
    """Blinker listener for registration initiations. Enqueqes a chain
    of archive tasks for the current node and its descendants

    :param src: Node being registered
    :param dst: registration Node
    :param user: registration initiator
    """
    # Prevent circular import with app.py
    from website.archiver import tasks
    archiver_utils.before_archive(dst, user)
    if dst.root != dst:  # if not top-level registration
        return
    archive_tasks = [tasks.archive(job_pk=t.archive_job._id) for t in dst.node_and_primary_descendants()]
    handlers.enqueue_task(
        celery.chain(archive_tasks)
    )