Skip to content

Commit b8c4256

Browse files
committed
track updates to Cisco Webex Teams backend
1 parent d2c3f60 commit b8c4256

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

local_backends/err-backend-cisco-webex-teams/CiscoWebexTeams.py

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import copyreg
23
import json
34
import sys
45
import logging
@@ -117,21 +118,23 @@ def find_using_email(self):
117118
"""
118119
Return the FIRST Cisco Webex Teams person found when searching using an email address
119120
"""
120-
for person in self._backend.webex_teams_api.people.list(email=self.email):
121-
self.teams_person = person
122-
return
123-
124-
raise FailedToFindWebexTeamsPerson(f'Could not find a user using the email address {self.email}')
121+
try:
122+
for person in self._backend.webex_teams_api.people.list(email=self.email):
123+
self.teams_person = person
124+
return
125+
except:
126+
raise FailedToFindWebexTeamsPerson(f'Could not find a user using the email address {self.email}')
125127

126128
def find_using_name(self):
127129
"""
128130
Return the FIRST Cisco Webex Teams person found when searching using the display name
129131
"""
130-
for person in self._backend.webex_teams_api.people.list(displayName=self.displayName):
131-
self.teams_person = person
132-
return
133-
134-
raise FailedToFindWebexTeamsPerson(f'Could not find the user using the displayName {self.displayName}')
132+
try:
133+
for person in self._backend.webex_teams_api.people.list(displayName=self.displayName):
134+
self.teams_person = person
135+
return
136+
except:
137+
raise FailedToFindWebexTeamsPerson(f'Could not find the user using the displayName {self.displayName}')
135138

136139
def get_using_id(self):
137140
"""
@@ -346,7 +349,7 @@ def invite(self, *args):
346349
log.debug("Invite room yet to be implemented") # TODO
347350
pass
348351

349-
def __eq_(self, other):
352+
def __eq__(self, other):
350353
return str(self) == str(other)
351354

352355
def __unicode__(self):
@@ -393,6 +396,8 @@ def __init__(self, config):
393396

394397
log.debug("Done! I'm connected as {}".format(self.bot_identifier.email))
395398

399+
self._register_identifiers_pickling()
400+
396401
@property
397402
def mode(self):
398403
return 'CiscoWebexTeams'
@@ -666,3 +671,19 @@ def recall_key(self, id, key):
666671
:return: Either the value of the key or None if the key is not found
667672
"""
668673
return self.recall(id).get(key)
674+
675+
@staticmethod
676+
def _unpickle_identifier(identifier_str):
677+
return CiscoWebexTeamsBackend.__build_identifier(identifier_str)
678+
679+
@staticmethod
680+
def _pickle_identifier(identifier):
681+
return CiscoWebexTeamsBackend._unpickle_identifier, (str(identifier),)
682+
683+
def _register_identifiers_pickling(self):
684+
"""
685+
Register identifiers pickling.
686+
"""
687+
CiscoWebexTeamsBackend.__build_identifier = self.build_identifier
688+
for cls in (CiscoWebexTeamsPerson, CiscoWebexTeamsRoomOccupant, CiscoWebexTeamsRoom):
689+
copyreg.pickle(cls, CiscoWebexTeamsBackend._pickle_identifier, CiscoWebexTeamsBackend._unpickle_identifier)
File renamed without changes.

0 commit comments

Comments
 (0)