コード例 #1
0
ファイル: events.py プロジェクト: donaldsmith2060/openstates
def _insert_with_id(event):
    abbr = event[event['level']]
    id = next_big_id(abbr, 'E', 'event_ids')
    logging.info("Saving as %s" % id)

    event['_id'] = id
    db.events.save(event, safe=True)

    return id
コード例 #2
0
ファイル: events.py プロジェクト: VersaHQ/billy
def _insert_with_id(event):
    abbr = event[settings.LEVEL_FIELD]
    id = next_big_id(abbr, 'E', 'event_ids')
    logger.info("Saving as %s" % id)

    event['_id'] = id
    db.events.save(event, safe=True)

    return id
コード例 #3
0
ファイル: events.py プロジェクト: dmc2015/billy
def _insert_with_id(event):
    abbr = event[settings.LEVEL_FIELD]
    id = next_big_id(abbr, "E", "event_ids")
    logger.info("Saving as %s" % id)

    event["_id"] = id
    db.events.save(event, safe=True)

    return id
コード例 #4
0
def _insert_with_id(event):
    abbr = event[event['level']]
    id = next_big_id(abbr, 'E', 'event_ids')
    logging.info("Saving as %s" % id)

    event['_id'] = id
    db.events.save(event, safe=True)

    return id
コード例 #5
0
ファイル: events.py プロジェクト: h4ck3rm1k3/billy
def _insert_with_id(event):
    abbr = event[settings.LEVEL_FIELD]
    _id = next_big_id(abbr, 'E', 'event_ids')
    logger.info("Saving as %s" % _id)

    event['_id'] = _id
    db.events.save(event, safe=True)

    return _id
コード例 #6
0
ファイル: test_utils.py プロジェクト: JT5D/billy
def test_next_big_id():
    db.test_ids.drop()
    db.vote_ids.drop()
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000001'
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000002'
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000003'
    assert utils.next_big_id('xy', 'V', 'vote_ids') == 'XYV00000001'
    db.test_ids.drop()
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000001'
    assert utils.next_big_id('xy', 'V', 'vote_ids') == 'XYV00000002'
コード例 #7
0
def test_next_big_id():
    db.test_ids.drop()
    db.vote_ids.drop()
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000001'
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000002'
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000003'
    assert utils.next_big_id('xy', 'V', 'vote_ids') == 'XYV00000001'
    db.test_ids.drop()
    assert utils.next_big_id('xy', 'D', 'test_ids') == 'XYD00000001'
    assert utils.next_big_id('xy', 'V', 'vote_ids') == 'XYV00000002'
コード例 #8
0
ファイル: bills.py プロジェクト: opengovernment/billy
 def _get_next_id(self):
     return next_big_id(self.abbr, self.id_letter, self.id_collection)
コード例 #9
0
ファイル: bills.py プロジェクト: Ferhub255/openstates
 def _get_next_id(self):
     return next_big_id(self.abbr, 'V', 'vote_ids')
コード例 #10
0
ファイル: bills.py プロジェクト: VersaHQ/billy
 def _get_next_id(self):
     return next_big_id(self.abbr, self.id_letter, self.id_collection)
コード例 #11
0
ファイル: bills.py プロジェクト: ipzero/openstates
 def _get_next_id(self):
     return next_big_id(self.abbr, 'V', 'vote_ids')