Skip to content

Commit 9326f2d

Browse files
committed
Tweak name of "already exists" option enum
1 parent 281a652 commit 9326f2d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

umapi_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .auth import JWTAuth, OAuthS2S
2323
from .connection import Connection
2424
from .error import BatchError, ClientError, RequestError, ServerError, UnavailableError, ArgumentError
25-
from .functional import IdentityType, IfAlreadyExistsOptions
25+
from .functional import IdentityType, IfAlreadyExistsOption
2626
from .functional import UserAction, UserQuery, UsersQuery
2727
from .functional import UserGroupAction, GroupsQuery
2828
from .version import __version__

umapi_client/functional.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class IdentityType(Enum):
3131
federatedID = 3
3232

3333

34-
class IfAlreadyExistsOptions(Enum):
34+
class IfAlreadyExistsOption(Enum):
3535
ignoreIfAlreadyExists = 1
3636
updateIfAlreadyExists = 2
3737
errorIfAlreadyExists = 3
@@ -79,7 +79,7 @@ def __repr__(self):
7979

8080
def create(self, email, first_name=None,
8181
last_name=None, country=None, id_type=IdentityType.federatedID,
82-
on_conflict=IfAlreadyExistsOptions.ignoreIfAlreadyExists):
82+
on_conflict=IfAlreadyExistsOption.ignoreIfAlreadyExists):
8383
"""
8484
Create the user on the Adobe back end.
8585
See [Issue 32](https://github.com/adobe-apiplatform/umapi-client.py/issues/32): because
@@ -99,11 +99,11 @@ def create(self, email, first_name=None,
9999
# first validate the params: email, on_conflict, first_name, last_name, country
100100
create_params = {}
101101
create_params["email"] = email
102-
if on_conflict in IfAlreadyExistsOptions.__members__:
103-
on_conflict = IfAlreadyExistsOptions[on_conflict]
104-
if on_conflict not in IfAlreadyExistsOptions:
105-
raise ArgumentError("on_conflict must be one of {}".format([o.name for o in IfAlreadyExistsOptions]))
106-
if on_conflict != IfAlreadyExistsOptions.errorIfAlreadyExists:
102+
if on_conflict in IfAlreadyExistsOption.__members__:
103+
on_conflict = IfAlreadyExistsOption[on_conflict]
104+
if on_conflict not in IfAlreadyExistsOption:
105+
raise ArgumentError("on_conflict must be one of {}".format([o.name for o in IfAlreadyExistsOption]))
106+
if on_conflict != IfAlreadyExistsOption.errorIfAlreadyExists:
107107
create_params["option"] = on_conflict.name
108108
if first_name: create_params["firstname"] = first_name
109109
if last_name: create_params["lastname"] = last_name
@@ -306,7 +306,7 @@ def remove_users(self, users=None):
306306
ulist = {"user": [user for user in users]}
307307
return self.append(remove=ulist)
308308

309-
def create(self, option=IfAlreadyExistsOptions.ignoreIfAlreadyExists, description=None):
309+
def create(self, option=IfAlreadyExistsOption.ignoreIfAlreadyExists, description=None):
310310
# only validate name on create/update so we can allow profiles and users to be managed for
311311
# system groups
312312
self._validate(self.frame['usergroup'])

0 commit comments

Comments
 (0)