Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def allow_contact(self, account, network_id=NetworkID.MSN,
done_cb=None, failed_cb=None):
def callback(memberships):
c = self.__build_or_update_contact(account, network_id, memberships)
self.__common_callback('contact-allowed', done_cb, c)
contact = self.search_contact(account, network_id)
old_memberships = (contact and contact.memberships) or Membership.NONE
if old_memberships & Membership.BLOCK:
self.unblock_contact(contact, done_cb, failed_cb)
else:
ac = scenario.AllowContactScenario(self._sharing,
(callback,),
(self.__common_errback, failed_cb))
ac.account = account
ac.network = network_id
ac.membership = old_memberships
ac()
def allow_contact(self, account, network_id=NetworkID.MSN,
done_cb=None, failed_cb=None):
def callback(memberships):
c = self.__build_or_update_contact(account, network_id, memberships)
self.__common_callback('contact-allowed', done_cb, c)
contact = self.search_contact(account, network_id)
old_memberships = (contact and contact.memberships) or Membership.NONE
if old_memberships & Membership.BLOCK:
self.unblock_contact(contact, done_cb, failed_cb)
else:
ac = scenario.AllowContactScenario(self._sharing,
(callback,),
(self.__common_errback, failed_cb))
ac.account = account
ac.network = network_id
ac.membership = old_memberships
ac()
def allow_contact(self, account, network_id=NetworkID.MSN,
done_cb=None, failed_cb=None):
def callback(memberships):
c = self.__build_or_update_contact(account, network_id, memberships)
self.__common_callback('contact-allowed', done_cb, c)
contact = self.search_contact(account, network_id)
old_memberships = (contact and contact.memberships) or Membership.NONE
if old_memberships & Membership.BLOCK:
self.unblock_contact(contact, done_cb, failed_cb)
else:
ac = scenario.AllowContactScenario(self._sharing,
(callback,),
(self.__common_errback, failed_cb))
ac.account = account
ac.network = network_id
ac.membership = old_memberships
ac()