AnsweredAssumed Answered

Different errors when passing string to invite_users

Question asked by mtaftferguso_UMass_Amherst on Aug 1, 2019
Latest reply on Jul 1, 2020 by

invite_users should actually take a list, of course. But if I pass a string by mistake/by not reading the docs closely enough, I encounter two different responses, neither of which indicates that the format was the issue, and one of which suggests there is any issue at all.


If I pass a nonsense string ("boo"), the value returned is simply True-- aka the same response as when I pass a list of valid usernames. Obviously with "boo" I wouldn't expect an actual user to have been invited, but I also get this response with invalid usernames, including for example a colleague's username with one letter missing. This non-error also occurs when I pass nonsense or invalid usernames via a list, which would make troubleshooting typos almost impossible.


If I pass a valid username as a string, though, I get the error "Unable to invite Public Account to a group owned by an organization." These users are not public accounts, they are organizational accounts owned by the same org that owns the group (OR are organizational accounts owned by a different org-- in both cases, it seems to recognize that the username is valid, even when external users' accounts are not publicly visible).


But a string is the wrong format, period. Why first of all is this not recognized or flagged in some way (an integer throws a TypeError)? Second, what is going on such that something evidently distinguishes between a string which is a valid username (in-org or not) and a string which is not even if it conforms to the same format as a proper organizational username (bsmith_umafm vs bmith_umafm, say)?