@@ -24,7 +24,7 @@ def parseRecords(self):
2424
2525class FilsysLookup (Lookup ):
2626 def __init__ (self , name ):
27- Lookup .__init__ (self , name , 'filsys' )
27+ Lookup .__init__ (self , name , b 'filsys' )
2828
2929 def parseRecords (self ):
3030 Lookup .parseRecords (self )
@@ -35,35 +35,35 @@ def parseRecords(self):
3535 for result in self .results :
3636 priority = 0
3737 if self .multiRecords :
38- result , priority = result .rsplit (" " , 1 )
38+ result , priority = result .rsplit (b " " , 1 )
3939 priority = int (priority )
4040
41- parts = result .split (" " )
41+ parts = result .split (b " " )
4242 type = parts [0 ]
43- if type == 'AFS' :
43+ if type == b 'AFS' :
4444 self .filsys .append (dict (type = type ,
4545 location = parts [1 ],
4646 mode = parts [2 ],
4747 mountpoint = parts [3 ],
4848 priority = priority ))
49- elif type == 'NFS' :
49+ elif type == b 'NFS' :
5050 self .filsys .append (dict (type = type ,
5151 remote_location = parts [1 ],
5252 server = parts [2 ],
5353 mode = parts [3 ],
5454 mountpoint = parts [4 ],
5555 priority = priority ))
56- elif type == 'ERR' :
56+ elif type == b 'ERR' :
5757 self .filsys .append (dict (type = type ,
5858 message = parts [1 ],
5959 priority = priority ))
60- elif type == 'UFS' :
60+ elif type == b 'UFS' :
6161 self .filsys .append (dict (type = type ,
6262 device = parts [1 ],
6363 mode = parts [2 ],
6464 mountpoint = parts [3 ],
6565 priority = priority ))
66- elif type == 'LOC' :
66+ elif type == b 'LOC' :
6767 self .filsys .append (dict (type = type ,
6868 location = parts [1 ],
6969 mode = parts [2 ],
@@ -76,28 +76,28 @@ def parseRecords(self):
7676
7777class PasswdLookup (Lookup ):
7878 def __init__ (self , name ):
79- Lookup .__init__ (self , name , 'passwd' )
79+ Lookup .__init__ (self , name , b 'passwd' )
8080
8181 def parseRecords (self ):
82- passwd_info = self .results [0 ].split (':' )
82+ passwd_info = self .results [0 ].split (b ':' )
8383 passwd_info [2 ] = int (passwd_info [2 ])
8484 passwd_info [3 ] = int (passwd_info [3 ])
8585 self .passwd = struct_passwd (passwd_info )
8686
8787class UidLookup (PasswdLookup ):
8888 def __init__ (self , uid ):
89- Lookup .__init__ (self , uid , 'uid' )
89+ Lookup .__init__ (self , b'%d' % ( uid ,), b 'uid' )
9090
9191class GroupLookup (Lookup ):
9292 def __init__ (self , group ):
93- Lookup .__init__ (self , group , 'group' )
93+ Lookup .__init__ (self , group , b 'group' )
9494
9595 def parseRecords (self ):
96- group_info = self .results [0 ].split (':' )
96+ group_info = self .results [0 ].split (b ':' )
9797 group_info [2 ] = int (group_info [2 ])
9898 members = group_info [3 ]
99- if members != '' :
100- members = members .split (',' )
99+ if members :
100+ members = members .split (b ',' )
101101 else :
102102 members = []
103103 group_info [3 ] = members
@@ -106,7 +106,7 @@ def parseRecords(self):
106106
107107class GidLookup (GroupLookup ):
108108 def __init__ (self , gid ):
109- Lookup .__init__ (self , gid , 'gid' )
109+ Lookup .__init__ (self , b'%d' % ( gid ,), b 'gid' )
110110
111111__all__ = ['bind' , 'resolve' ,
112112 'Lookup' , 'FilsysLookup' , 'PasswdLookup' , 'UidLookup' ,
0 commit comments