Ignore:
Timestamp:
Dec 1, 2017, 11:38:50 AM (2 years ago)
Author:
mabarracus
Message:

Fix type checks with unicode vars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hwdetector/trunk/fuentes/hwdetector.install/hwdetector/modules/llxldap.py

    r6399 r6420  
    8686
    8787    def parse_tree(self,*args,**kwargs):
    88         if type(args[0]) != type(str()):
     88        if not (isinstance(args[0],str) or isinstance(args[0],unicode)):
    8989            return None
    9090        output = {}
     
    127127            out = args[1]
    128128        for k in d.keys():
    129             if type(d[k]) == type(dict()):
     129            if isinstance(d[k],dict):
    130130                split = k.split('=')
    131131                if len(split) > 1:
     
    267267                netinfo=kwargs['NETINFO']
    268268                if netinfo:
    269                     aliased_interfaces = [ k for k in netinfo if type(netinfo[k]) == type(dict()) and 'nalias' in netinfo[k] and netinfo[k]['nalias'] > 0 ]
     269                    aliased_interfaces = [ k for k in netinfo if isinstance(netinfo[k],dict) and 'nalias' in netinfo[k] and netinfo[k]['nalias'] > 0 ]
    270270                    for i in aliased_interfaces:
    271271                        for n in range(netinfo[i]['nalias']):
Note: See TracChangeset for help on using the changeset viewer.