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
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
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
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
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'
def _get_next_id(self): return next_big_id(self.abbr, self.id_letter, self.id_collection)
def _get_next_id(self): return next_big_id(self.abbr, 'V', 'vote_ids')