Commit 9d4f8a2d authored by Valentin Samir's avatar Valentin Samir
Browse files

Search by unicode string

parent 87cc8273
......@@ -56,7 +56,7 @@ def ssh_keygen(algo,size):
def get_machines():
machines=[]
for ip in set(ip4_addresses()):
machines.extend(conn.search('ipHostNumber=%s' %ip,mode='rw'))
machines.extend(conn.search(u'ipHostNumber=%s' % ip, mode='rw'))
return machines
def check_keys_age(key_path,algo):
......
......@@ -14,7 +14,7 @@ conn=lc_ldap.shortcuts.lc_ldap_admin()
def gen_multidial(droit):
dial="exten => %(droit)s,1,Ringing\nexten => %(droit)s,n,Wait(4)\nexten => %(droit)s,n,Answer\nexten => %(droit)s,n,Dial(" % {'droit':droit}
adhs=conn.search('(&(droits=%s)(!(chbre=EXT)))' % droit)
adhs=conn.search(u'(&(droits=%s)(!(chbre=EXT)))' % droit)
for nounou in adhs:
dial+="SIP/1%04d&" % nounou['aid'][0].value
return dial[:-1]+",30)\nexten => %(droit)s,n,Wait(3)\nexten => %(droit)s,n,VoiceMail(%(droit)s@666)\nexten => %(droit)s,n,Hangup()\n" % {'droit':droit}
......
......@@ -89,16 +89,16 @@ def get(str):
def get_machine_by_mac(ip):
mac_addr=mac_from_ip(ip)
machines = get('macAddress=%s' % mac_addr)
machines = get(u'macAddress=%s' % mac_addr)
if machines and isinstance(machines[0], lc_ldap.objets.machineWifi):
if not 'ipHostNumber' in machines[0].attrs.keys():
machine = QUERY.search('macAddress=%s' % mac_addr, mode='rw')[0]
machine = QUERY.search(u'macAddress=%s' % mac_addr, mode='rw')[0]
machine.set_ipv4()
return machines
def get_machine_by_ip(ip):
return get('ipHostNumber=%s' % ip)
return get(u'ipHostNumber=%s' % ip)
def get_page(ip, by_mac=False, accueil=False):
try:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment