Crunch-io / scrunch

Pythonic scripting library for cleaning data in Crunch
GNU Lesser General Public License v3.0
5 stars 7 forks source link

Adding a team member fails #380

Open jamesrkg opened 4 years ago

jamesrkg commented 4 years ago

The below fails using scrunch even though the user_email is definitely known to Crunch. Switching to the UI to add the member there instead succeeds.

>>> team = scrunch.get_team(team_name)
>>> team.members.add(user_email)
KeyErrorTraceback (most recent call last)
<ipython-input-11-ed5ef572543b> in <module>()
      1 inq = scrunch.get_team('Affiliate Poland: Inquiry')
----> 2 inq.members.add('o.podbielska@inquiry.com.pl')

c:\users\jamesg\documents\techops\dev\scrunch\scrunch\datasets.pyc in add(self, member, edit)
    381         :return: None
    382         """
--> 383         member = self._validate_member(member)
    384         self.resource.members.patch({member.url: {
    385             'permissions': {self._EDIT_ATTRIBUTE: edit}

c:\users\jamesg\documents\techops\dev\scrunch\scrunch\datasets.pyc in _validate_member(self, member)
    365                 member = get_team(member)
    366             except:
--> 367                 raise KeyError('Member %s is not a Team nor a User' % member)
    368         return member
    369 

KeyError: 'Member XXX is not a Team nor a User'