def _save_update(update): delicious_id = update["u"] src = u"delicious:%s" % settings.DELICIOUS_USERNAME # check that update isn't already stored if collection.find_one({"u":delicious_id, "lifestream:source":src}): log.debug("update (%s) already saved" % update["u"]) return # save to db update["lifestream:provider"] = "delicious" update["lifestream:source"] = src update["lifestream:timestamp"] = utils.parsedateutc(update["dt"]) update["lifestream:added"] = datetime.utcnow() collection.insert(update)