def _do_set_contacts_override(self, *args, **kwargs): if _Debug: lg.out( _DebugLevel, 'proxy_router.doSetContactsOverride identity for %s' % args[0].CreatorID) user_id = args[0].CreatorID idsrc = args[0].Payload try: new_ident = identity.identity(xmlsrc=idsrc) except: lg.out(_DebugLevel, 'payload: [%s]' % idsrc) lg.exc() return if not new_ident.isCorrect() or not new_ident.Valid(): lg.warn('incoming identity is not valid') return current_overridden_identity = identitycache.ReadOverriddenIdentityXMLSource( user_id) try: current_contacts = identity.identity( xmlsrc=current_overridden_identity).getContacts() except: current_contacts = [] identitycache.StopOverridingIdentity(user_id) result = identitycache.OverrideIdentity(args[0].CreatorID, idsrc) if _Debug: lg.out( _DebugLevel, ' current overridden contacts is : %s' % current_contacts) lg.out( _DebugLevel, ' new override contacts will be : %s' % new_ident.getContacts()) lg.out(_DebugLevel, ' result=%s' % result)
def doCheckOverride(self, arg): """ Action method. """ if _Debug: lg.out( _DebugLevel, 'proxy_router.doCheckOverride identity for %s' % arg.CreatorID) user_id = arg.CreatorID idsrc = arg.Payload try: new_ident = identity.identity(xmlsrc=idsrc) except: lg.out(_DebugLevel, 'payload: [%s]' % idsrc) lg.exc() return if not new_ident.isCorrect() or not new_ident.Valid(): lg.warn('incoming identity is not valid') return current_overridden_identity = identitycache.ReadOverriddenIdentityXMLSource( user_id) try: current_contacts = identity.identity( xmlsrc=current_overridden_identity).getContacts() except: current_contacts = [] if _Debug: lg.out(_DebugLevel, ' current override contacts is : %s' % current_contacts) identitycache.StopOverridingIdentity(user_id) if not self._is_my_contacts_present_in_identity(new_ident): if _Debug: lg.out(_DebugLevel, ' DO OVERRIDE identity for %s' % arg.CreatorID) lg.out(_DebugLevel, ' new contacts is : %s' % new_ident.getContacts()) identitycache.OverrideIdentity(arg.CreatorID, idsrc) else: if _Debug: lg.out(_DebugLevel, ' SKIP OVERRIDE identity from %s' % arg.CreatorID) lg.out(_DebugLevel, ' new contacts was : %s' % new_ident.getContacts())