Getting all groups but not 'AuthenticatedUsers'

I use:

members_groups = api.group.get_groups(user=member)
all_groups = ',  '.join(str(e) for e in member_groups[0:])

( which shows something like 'Member of football, tennis', 'etc' in a browser view.pt

Is there a syntax for getting every group but not 'AuthenticatedUsers' (it is a Virtual Group'.)
(instead of searching for it and removing it ):

yeah, list.remove:

>>> groups = ['AuthenticatedUsers','Monkey', 'Nut', 'Fire']
>>> groups.remove('AuthenticatedUsers')
>>> groups
['Monkey', 'Nut', 'Fire']

Thanks…

I was a bit unsure if 'AuthenticatedUsers' could end up being translated somewhere, or if groups are:

 groups = ['AuthenticatedUsers','Monkey', 'Nut', 'Fire']

or

groups = [< Some Groups Object>, < Some other object>]

EDIT the above line had disappeared.

Makes no sense..the API does not exposed ids or whatever in a translated way...you should know this.

groups = api.group.get_groups(user=member) gives group=

[< GroupData at /xxx/portal_groupdata/AuthenticatedUsers used for /xxx/acl_users>,  
  <GroupData at /xxx/portal_groupdata/ABC used for /dgh/acl_users/source_groups>]

So, to remove it I need to convert it to string somehow ??
Something like this would work, but it looks very clumsy…

groups = api.group.get_groups(user=member)   
grup = ' '.join(str(e) for e in groups).split()
grup.remove('AuthenticatedUsers')
group = ', '.join(str(e) for e in grup)

Why are you joining the names and then splitting it again?
Just do this:

groups = api.group.get_groups(user=member) 
groups = [e.getGroupName() for e in groups]
groups.remove('AuthenticatedUsers')
groups = ','.join(groups)

Unsure about the e.getGroupName() stuff, though. It might be e.id, or something like that.

because I did not think/know of doing it the e.getGroupName way… so I ended up with an 'id that changed'. :blush:

Thanks for your help

Oh, not that, but the grup = ' '.join(str(e) for e in groups).split() bit :smiley:
grup = [str(e) for e in groups] is the same :slight_smile: