From 7a3cfbc175ae9215a86b37aaa69c39aac84a47ce Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 2 Aug 2017 08:53:12 +0200 Subject: [PATCH] avoid error when no groups folder is found (e.g. in doctests) --- organize/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/organize/util.py b/organize/util.py index 6d97f0a..79a15eb 100644 --- a/organize/util.py +++ b/organize/util.py @@ -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)]