comdev/google_api.py
def update_membership(self, contact, group):
        '''
        input: gdata ContactEntry and GroupEntry objects
        '''
        if not contact:
            log.debug('Not updating membership for EMPTY contact.')
            return None
        _uid = contact.email[0].address
        _gtitle = group.title.text

        for contact_group in contact.group_membership_info:
            if contact_group.href == group.get_id():
                log.warn(
                    ' ... {} already a member of {}.'.format(_uid, _gtitle))
                return contact

        log.debug('Adding {} to group {}'.format(_uid, _gtitle))
        membership = self.api.contacts.data.GroupMembershipInfo(
            href=group.id.text)
        contact.group_membership_info.append(membership)
        contact = self.api.update(contact)
        return contact
def update_membership(self, contact, group):
        '''
        input: gdata ContactEntry and GroupEntry objects
        '''
        if not contact:
            log.debug('Not updating membership for EMPTY contact.')
            return None
        _uid = contact.email[0].address
        _gtitle = group.title.text

        for contact_group in contact.group_membership_info:
            if contact_group.href == group.get_id():
                log.warn(
                    ' ... {} already a member of {}.'.format(_uid, _gtitle))
                return contact

        log.debug('Adding {} to group {}'.format(_uid, _gtitle))
        membership = self.api.contacts.data.GroupMembershipInfo(
            href=group.id.text)
        contact.group_membership_info.append(membership)
        contact = self.api.update(contact)
        return contact
def update_membership ( self , contact , group ) : if not contact : log . debug ( 'Not updating membership for EMPTY contact.' ) return None _uid = contact . email [ 0 ] . address _gtitle = group . title . text for contact_group in contact . group_membership_info : if contact_group . href == group . get_id ( ) : log . warn ( ' ... {} already a member of {}.' . format ( _uid , _gtitle ) ) return contact log . debug ( 'Adding {} to group {}' . format ( _uid , _gtitle ) ) membership = self . api . contacts . data . GroupMembershipInfo ( href = group . id . text ) contact . group_membership_info . append ( membership ) contact = self . api . update ( contact ) return contact
input: gdata ContactEntry and GroupEntry objects
input : gdata ContactEntry and GroupEntry objects