Exemple #1
0
    def fn(row, action, users, nodes, actions):
        if orm.NodeState.objects.filter(state_type=state,
                                        node=action.node_id).count():
            return

        orm.NodeState(state_type=state, node_id=action.node_id,
                      action=action).save()
Exemple #2
0
def add_post_state(name, post, action):
    if not "(%s)" % name in post.state_string:
        post.state_string = "%s(%s)" % (post.state_string, name)
        post.save()

    try:
        state = orm.NodeState.objects.get(node=post, state_type=name)
        state.action = action
        state.save()
    except:
        state = orm.NodeState(node=post, state_type=name, action=action)
        state.save()