Example #1
0
 def make_user_contact(self, contact_id, user_id):
     with transaction.manager:
         c = UserContact()
         c.contact_id = contact_id
         c.user_id = user_id
         self.session.add(c)
     return self.session.merge(c)
Example #2
0
 def make_group_contact(self, contact_id, group_id):
     with transaction.manager:
         c = UserContact()
         c.contact_id = contact_id
         c.group_id = group_id
         self.session.add(c)
     return self.session.merge(c)
Example #3
0
 def add_contact(self, user_id, firstname, lastname=None, email=None,
                 phone=None):
     with transaction.manager:
         c = Contact(firstname, lastname, email, phone)
         self.session.add(c)
         c = self.session.merge(c)
         uc = UserContact()
         uc.contact_id = c.id
         uc.user_id = user_id
         self.session.add(uc)
     return self.session.merge(c)