Browse Source

[FIX] asterisk_click2dial: Travis errors

pull/196/head
Maxime Chambreuil 5 years ago
parent
commit
38f2c044c3
  1. 12
      asterisk_click2dial/scripts/set_name_agi.py

12
asterisk_click2dial/scripts/set_name_agi.py

@ -115,8 +115,8 @@ options = [
'(will not try to connect to Odoo)'}, '(will not try to connect to Odoo)'},
{'names': ('-p', '--port'), 'dest': 'port', 'type': 'int', {'names': ('-p', '--port'), 'dest': 'port', 'type': 'int',
'action': 'store', 'default': False, 'action': 'store', 'default': False,
'help': "Port of Odoo's webservice interface. Default = 443 when SSL is on, "
"8069 when SSL is off"},
'help': "Port of Odoo's webservice interface. Default = 443 when SSL "
"is on, 8069 when SSL is off"},
{'names': ('-e', '--ssl'), 'dest': 'ssl', {'names': ('-e', '--ssl'), 'dest': 'ssl',
'help': "Use SSL connections instead of clear connections. " 'help': "Use SSL connections instead of clear connections. "
"Default = no, use clear XML-RPC or JSON-RPC", "Default = no, use clear XML-RPC or JSON-RPC",
@ -206,7 +206,7 @@ def geolocate_phone_number(number, my_country_code, lang):
def convert_to_ascii(my_unicode): def convert_to_ascii(my_unicode):
'''Convert to ascii, with clever management of accents (é -> e, è -> e)''' '''Convert to ascii, with clever management of accents (é -> e, è -> e)'''
import unicodedata import unicodedata
if isinstance(my_unicode, unicode):
if isinstance(my_unicode, bytes):
my_unicode_with_ascii_chars_only = ''.join(( my_unicode_with_ascii_chars_only = ''.join((
char for char in unicodedata.normalize('NFD', my_unicode) char for char in unicodedata.normalize('NFD', my_unicode)
if unicodedata.category(char) != 'Mn')) if unicodedata.category(char) != 'Mn'))
@ -233,9 +233,9 @@ def main(options, arguments):
# connect to Odoo or geoloc, we just keep it # connect to Odoo or geoloc, we just keep it
phone_chars = [str(d) for d in range(10)] phone_chars = [str(d) for d in range(10)]
phone_chars += ['+'] phone_chars += ['+']
if (
agi.env.get('agi_calleridname') and
any([x not in phone_chars for x in agi.env['agi_calleridname']]) and
if (agi.env.get('agi_calleridname') and
any([x not in phone_chars for x in
agi.env['agi_calleridname']]) and
agi.env['agi_calleridname'].lower() agi.env['agi_calleridname'].lower()
not in ['asterisk', 'unknown', 'anonymous'] and not in ['asterisk', 'unknown', 'anonymous'] and
not options.notify): not options.notify):

Loading…
Cancel
Save