src/update_contacts.py
def ab_group_to_dict(group):
    """Convert ABGroup to Python dict. Return None if group is empty."""
    d = {'name': '', 'emails': [], 'is_group': True, 'is_company': False}
    d['name'] = group.valueForProperty_(AB.kABGroupNameProperty)

    for person in group.members():
        identifier = group.distributionIdentifierForProperty_person_(
            AB.kABEmailProperty, person)

        if identifier:
            emails = person.valueForProperty_(AB.kABEmailProperty)
            email = emails.valueAtIndex_(
                emails.indexForIdentifier_(identifier))
            # log.debug('{} is in group {}'.format(email, d['name']))
            d['emails'].append(email)

    if not len(d['emails']):
        return None

    return d
Convert ABGroup to Python dict. Return None if group is empty.
Convert ABGroup to Python dict. Return None if group is empty.
Convert ABGroup to Python dict . Return None if group is empty .
def ab_group_to_dict(group):
    d = {'name': '', 'emails': [], 'is_group': True, 'is_company': False}
    d['name'] = group.valueForProperty_(AB.kABGroupNameProperty)
    for person in group.members():
        identifier = group.distributionIdentifierForProperty_person_(
            AB.kABEmailProperty, person)
        if identifier:
            emails = person.valueForProperty_(AB.kABEmailProperty)
            email = emails.valueAtIndex_(
                emails.indexForIdentifier_(identifier))
            d['emails'].append(email)
    if not len(d['emails']):
        return None
    return d
def ab_group_to_dict ( group ) : d = { 'name' : '' , 'emails' : [ ] , 'is_group' : True , 'is_company' : False } d [ 'name' ] = group . valueForProperty_ ( AB . kABGroupNameProperty ) for person in group . members ( ) : identifier = group . distributionIdentifierForProperty_person_ ( AB . kABEmailProperty , person ) if identifier : emails = person . valueForProperty_ ( AB . kABEmailProperty ) email = emails . valueAtIndex_ ( emails . indexForIdentifier_ ( identifier ) ) d [ 'emails' ] . append ( email ) if not len ( d [ 'emails' ] ) : return None return d
Convert ABGroup to Python dict.
Convert ABGroup to Python dict .
"""Convert ABGroup to Python dict. Return None if group is empty.""" # log.debug('{} is in group {}'.format(email, d['name']))
group