1from Foundation import * 2import os, pwd 3 4 5def getPasswords(): 6 a = NSMutableArray.array() 7 for pw in pwd.getpwall(): 8 a.append({ 9 'name': pw.pw_name, 10 'password': pw.pw_passwd, 11 'uid': str(pw.pw_uid), 12 'gid': str(pw.pw_gid), 13 'gecos': pw.pw_gecos, 14 'home_dir': pw.pw_dir, 15 'shell': pw.pw_shell, 16 }) 17 18 return a 19 20class TableModelWithSearchAppDelegate (NSObject): 21 def passwords(self): 22 if not hasattr(self, '_cachedpasswords'): 23 self._cachedpasswords = getPasswords() 24 return self._cachedpasswords 25