avoid error when no groups folder is found (e.g. in doctests)
This commit is contained in:
parent
63220a656f
commit
7a3cfbc175
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2017 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -134,6 +134,8 @@ def getGroupsForPrincipal(principal=None):
|
|||
if principal is None:
|
||||
principal = getCurrentPrincipal()
|
||||
gf = getGroupsFolder()
|
||||
if gf is None:
|
||||
return []
|
||||
prefix = 'gloops.'
|
||||
return [(g.startswith(prefix) and g[len(prefix):] or g)
|
||||
for g in gf.getGroupsForPrincipal(principal.id)]
|
||||
|
|
Loading…
Add table
Reference in a new issue