import telepathy
import tp
-import util.misc as util_misc
+import util.misc as misc_utils
-_moduleLogger = logging.getLogger("handle")
+_moduleLogger = logging.getLogger(__name__)
class TheOneRingHandle(tp.Handle):
class ContactHandle(TheOneRingHandle):
def __init__(self, connection, id, phoneNumber):
- self._phoneNumber = util_misc.normalize_number(phoneNumber)
+ self._phoneNumber = misc_utils.normalize_number(phoneNumber)
handleType = telepathy.HANDLE_TYPE_CONTACT
handleName = self._phoneNumber
cache = weakref.WeakValueDictionary()
- def create_handle(connection, type, *args):
+ def _create_handle(connection, type, *args):
Handle = _HANDLE_TYPE_MAPPING[type]
key = Handle, connection.username, args
try:
cache[key] = handle
isNewHandle = True
connection._handles[handle.get_type(), handle.get_id()] = handle
- handleStatus = "Is New!" if isNewHandle else "From Cache"
- _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus))
+ if isNewHandle:
+ handleStatus = "Is New!" if isNewHandle else "From Cache"
+ _moduleLogger.debug("Created Handle: %r (%s)" % (handle, handleStatus))
return handle
- return create_handle
+ return _create_handle
create_handle = create_handle_factory()