(self, wanted_user)
return (str(usr.pw_name), str(usr.pw_uid), str(usr.pw_gid),
                str(usr.pw_gecos), usr.pw_dir, usr.pw_shell)
get user information from the host /etc/passwd
get user information from the host /etc/passwd
get user information from the host / etc / passwd
def _get_user_from_host(self, wanted_user):
        """get user information from the host /etc/passwd"""
        wanted_uid = ""
        if (isinstance(wanted_user, int) or
                re.match("^\\d+$", wanted_user)):
            wanted_uid = str(wanted_user)
            wanted_user = ""

        if wanted_uid:
            try:
                usr = pwd.getpwuid(int(wanted_uid))
            except (IOError, OSError, KeyError):
                return ("", "", "", "", "", "")
            return (str(usr.pw_name), str(usr.pw_uid), str(usr.pw_gid),
                    str(usr.pw_gecos), usr.pw_dir, usr.pw_shell)
        try:
            usr = pwd.getpwnam(wanted_user)
        except (IOError, OSError, KeyError):
            return ("", "", "", "", "", "")
        return (str(usr.pw_name), str(usr.pw_uid), str(usr.pw_gid),
                str(usr.pw_gecos), usr.pw_dir, usr.pw_shell)
def _get_user_from_host ( self , wanted_user ) : wanted_uid = "" if ( isinstance ( wanted_user , int ) or re . match ( "^\\d+$" , wanted_user ) ) : wanted_uid = str ( wanted_user ) wanted_user = "" if wanted_uid : try : usr = pwd . getpwuid ( int ( wanted_uid ) ) except ( IOError , OSError , KeyError ) : return ( "" , "" , "" , "" , "" , "" ) return ( str ( usr . pw_name ) , str ( usr . pw_uid ) , str ( usr . pw_gid ) , str ( usr . pw_gecos ) , usr . pw_dir , usr . pw_shell ) try : usr = pwd . getpwnam ( wanted_user ) except ( IOError , OSError , KeyError ) : return ( "" , "" , "" , "" , "" , "" ) return ( str ( usr . pw_name ) , str ( usr . pw_uid ) , str ( usr . pw_gid ) , str ( usr . pw_gecos ) , usr . pw_dir , usr . pw_shell )