X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/blobdiff_plain/76b00ab5bf3750a131294674c402ee17930b4309..5f256964f30b0f7423034048b7911600f8d4c3a9:/afs/pts.py diff --git a/afs/pts.py b/afs/pts.py index 4d3e17c..f99bc8f 100644 --- a/afs/pts.py +++ b/afs/pts.py @@ -1,7 +1,12 @@ import collections from afs import _pts -class PTRelationSet(collections.MutableSet): +try: + SetMixin = collections.MutableSet +except AttributeError: + SetMixin = object + +class PTRelationSet(SetMixin): """Collection class for the groups/members of a PTEntry. This class, which acts like a set, is actually a view of the @@ -167,6 +172,16 @@ class PTRelationSet(collections.MutableSet): self._discard(elt) + def remove(self, elt): + """Remove an entity from a group; it must already be a member. + + If the entity is not a member, raise a KeyError. + """ + if elt not in self: + raise KeyError(elt) + + self.discard(elt) + class PTEntry(object): """An entry in the AFS protection database.