コード例 #1
0
 def create(cls, master_id, eliot_task_id, rule_name):
     from invenio_records.models import Record
     self = cls(master_id)
     self.status = StatusMaster.booting
     self.all_recids = Record.allids()  # `create` is a good time for this.
     self._rule_name = rule_name
     super(RedisMaster, self).create(eliot_task_id)
     return self
コード例 #2
0
    def test_detailed_records(self):
        """Test visiting each detailed record returns 200"""
        from invenio_records.models import Record

        self.login('admin', 'admin')  # To also check restricted records
        for recid in Record.allids():
            response = self.client.get("/record/{recid}".format(recid=recid))
            if response.status_code != 200:
                raise Exception(response, recid)
コード例 #3
0
ファイル: master.py プロジェクト: dset0x/invenio-checker
    def create(cls, master_id, eliot_task_id, rule_name):
        from invenio_records.models import Record

        self = cls(master_id)
        self.status = StatusMaster.booting
        self.all_recids = Record.allids()  # `create` is a good time for this.
        self._rule_name = rule_name
        super(RedisMaster, self).create(eliot_task_id)
        return self
コード例 #4
0
ファイル: test_views.py プロジェクト: tomaszgy/inspire-next
 def test_detailed_records(self):
     """Test visiting each detailed record returns 200"""
     from invenio_records.models import Record
     failing_recids = []
     for recid in Record.allids():
         try:
             if self.client.get("/record/{recid}".format(recid=recid)).status_code != 200:
                 failing_recids.append(recid)
         except Exception:
             failing_recids.append(recid)
     self.failIf(failing_recids)
コード例 #5
0
ファイル: master.py プロジェクト: dset0x/invenio-checker-old
    def __init__(self, master_id, eliot_task_id=None, rule_name=None):
        """Initialize a lock handle for a certain master.

        ..note::
            Registers the master with redis if it does not already exist.

        :type master_id: str
        """
        from invenio_records.models import Record
        super(RedisMaster, self).__init__(master_id, eliot_task_id)

        if not RedisMaster._already_instnatiated(master_id):
            self.all_recids = Record.allids()  # __init__ is a good time for this.
            self.status = StatusMaster.booting
            self._rule_name = rule_name
コード例 #6
0
def search_unit(query, f, m, wl=None):
    """Search for records with given citation count.

    Query usually looks like '10->23'.
    """
    from invenio_records.models import Record
    from invenio.legacy.bibrank.citation_searcher import (
        get_records_with_num_cites)
    numstr = '"{}"'.format(query)
    #this is sort of stupid but since we may need to
    #get the records that do _not_ have cites, we have to
    #know the ids of all records, too
    #but this is needed only if bsu_p is 0 or 0 or 0->0
    allrecs = intbitset()
    if query == 0 or query == "0" or \
       query.startswith("0->") or query.endswith("->0"):
        allrecs = Record.allids()
    return get_records_with_num_cites(numstr, allrecs)
コード例 #7
0
def search_unit(query, f, m, wl=None):
    """Search for records with given citation count excluding self-cites.

    Query usually looks like '10->23'.
    """
    from invenio_records.models import Record
    from invenio.legacy.bibrank.citation_searcher import (
        get_records_with_num_cites
    )
    numstr = '"{}"'.format(query)
    # this is sort of stupid but since we may need to
    # get the records that do _not_ have cites, we have to
    # know the ids of all records, too
    # but this is needed only if bsu_p is 0 or 0 or 0->0
    allrecs = intbitset()
    if query == 0 or query == "0" or \
       query.startswith("0->") or query.endswith("->0"):
        allrecs = Record.allids()
    return get_records_with_num_cites(numstr, allrecs, exclude_selfcites=True)