Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Switches to the generic toggle function of onegov.core
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Aug 31, 2017
1 parent b78f2c9 commit abec9b1
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions onegov/user/collections/user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import Iterable
from onegov.core.crypto import random_token
from onegov.core.utils import toggle
from onegov.user import log
from onegov.user.models import User
from onegov.user.errors import (
Expand Down Expand Up @@ -33,16 +34,6 @@ def as_dictionary_of_sets(d):
}


def toggle(collection, item):
if item is None:
return collection

if item in collection:
return collection - {item}
else:
return collection | {item}


class UserCollection(object):
""" Manages a list of users.
Expand Down

0 comments on commit abec9b1

Please sign in to comment.