Пример #1
0
    def reject_record(self, recid, pretend=False):
        """
        Reject a record for inclusion in a community

        @param recid: Record ID
        """
        expected_id = self.get_collection_name(provisional=True)
        new_id = self.get_collection_name(provisional=False)

        append_colls, replace_colls = signalresult2list(pre_curation.send(
            self, action='reject', recid=recid, pretend=pretend))

        def test_func(code, val):
            return False

        def replace_func(code, val):
            return (code, val)

        def include_func(code, val):
            return not (code == 'a' and (val == expected_id or val == new_id))

        rec = self._upload_record(
            self._modify_record(
                recid, test_func, replace_func, include_func,
                append_colls=append_colls, replace_colls=replace_colls
            ),
            pretend=pretend
        )

        post_curation.send(self, action='reject', recid=recid, record=rec,
                           pretend=pretend)
        return rec
Пример #2
0
    def accept_record(self, recid, pretend=False):
        """
        Accept a record for inclusion in a community

        @param recid: Record ID
        """
        expected_id = self.get_collection_name(provisional=True)
        new_id = self.get_collection_name(provisional=False)

        append_colls, replace_colls = signalresult2list(pre_curation.send(
            self, action='accept', recid=recid, pretend=pretend))

        def test_func(code, val):
            return code == 'a' and val == expected_id

        def replace_func(code, val):
            return (code, new_id)

        def include_func(code, val):
            return True

        rec = self._upload_record(
            self._modify_record(
                recid, test_func, replace_func, include_func,
                append_colls=append_colls, replace_colls=replace_colls
            ),
            pretend=pretend
        )

        self.last_record_accepted = datetime.now()
        db.session.commit()
        post_curation.send(self, action='accept', recid=recid, record=rec,
                           pretend=pretend)
        return rec
Пример #3
0
    def accept_record(self, recid, pretend=False):
        """Accept a record for inclusion in a community.

        @param recid: Record ID
        """
        expected_id = self.get_collection_name(provisional=True)
        new_id = self.get_collection_name(provisional=False)

        append_colls, replace_colls = signalresult2list(
            pre_curation.send(self,
                              action='accept',
                              recid=recid,
                              pretend=pretend))

        def test_func(code, val):
            return code == 'a' and val == expected_id

        def replace_func(code, val):
            return (code, new_id)

        def include_func(code, val):
            return True

        rec = self._upload_record(self._modify_record(
            recid,
            test_func,
            replace_func,
            include_func,
            append_colls=append_colls,
            replace_colls=replace_colls),
                                  pretend=pretend)

        self.last_record_accepted = datetime.now()
        db.session.commit()
        post_curation.send(self,
                           action='accept',
                           recid=recid,
                           record=rec,
                           pretend=pretend)
        return rec
Пример #4
0
    def reject_record(self, recid, pretend=False):
        """Reject a record for inclusion in a community.

        @param recid: Record ID
        """
        expected_id = self.get_collection_name(provisional=True)
        new_id = self.get_collection_name(provisional=False)

        append_colls, replace_colls = signalresult2list(
            pre_curation.send(self,
                              action='reject',
                              recid=recid,
                              pretend=pretend))

        def test_func(code, val):
            return False

        def replace_func(code, val):
            return (code, val)

        def include_func(code, val):
            return not (code == 'a' and (val == expected_id or val == new_id))

        rec = self._upload_record(self._modify_record(
            recid,
            test_func,
            replace_func,
            include_func,
            append_colls=append_colls,
            replace_colls=replace_colls),
                                  pretend=pretend)

        post_curation.send(self,
                           action='reject',
                           recid=recid,
                           record=rec,
                           pretend=pretend)
        return rec