def create(cls, principal, agent, scope, replay=True): from adhocracy.lib.democracy import Decision delegation = Delegation(principal, agent, scope) meta.Session.add(delegation) meta.Session.flush() if replay: log.debug("Replaying the vote for Delegation: %s" % delegation) Decision.replay_decisions(delegation) return delegation