This avoids problems with trying to iterate None.
def __init__(self, name, emails=None, pgp_key=None, aliases=None,
groups=None):
self.name = name
+ if emails is None:
+ emails = []
self.emails = emails
self.pgp_key = pgp_key
if not aliases:
aliases = [self.name]
self.aliases = aliases
+ if groups is None:
+ groups = []
self.groups = groups
def __str__(self):
Gandalf: ['g@grey.edu', 'g@greyhavens.net'] | 0x0123456789ABCDEF
>>> p = load_person(name='Gandalf')
>>> print('{0.name}: {0.emails} | {0.pgp_key}'.format(p))
- Gandalf: None | None
+ Gandalf: [] | None
"""
kwargs = {}
emails = [x.strip() for x in data.get('emails', '').split(',')]