From: <pj...@us...> - 2009-10-31 01:48:38
|
Revision: 6936 http://jython.svn.sourceforge.net/jython/?rev=6936&view=rev Author: pjenvey Date: 2009-10-31 01:48:29 +0000 (Sat, 31 Oct 2009) Log Message: ----------- only use the Group/Passwd interface API, and convert the unicode values to regular strs Modified Paths: -------------- trunk/jython/Lib/grp.py trunk/jython/Lib/pwd.py Modified: trunk/jython/Lib/grp.py =================================================================== --- trunk/jython/Lib/grp.py 2009-10-31 01:46:11 UTC (rev 6935) +++ trunk/jython/Lib/grp.py 2009-10-31 01:48:29 UTC (rev 6936) @@ -18,6 +18,7 @@ __all__ = ['getgrgid', 'getgrnam', 'getgrall'] from os import _name, _posix_impl +from org.python.core.Py import newString if _name == 'nt': raise ImportError, 'grp module not supported on Windows' @@ -34,8 +35,9 @@ attrs = ['gr_name', 'gr_passwd', 'gr_gid', 'gr_mem'] def __new__(cls, grp): - return tuple.__new__(cls, (grp.gr_name, grp.gr_passwd, grp.gr_gid, - list(grp.getMembers()))) + grp = (newString(grp.name), newString(grp.password), grp.GID, + [newString(member) for member in grp.members]) + return tuple.__new__(cls, grp) def __getattr__(self, attr): try: Modified: trunk/jython/Lib/pwd.py =================================================================== --- trunk/jython/Lib/pwd.py 2009-10-31 01:46:11 UTC (rev 6935) +++ trunk/jython/Lib/pwd.py 2009-10-31 01:48:29 UTC (rev 6936) @@ -11,6 +11,7 @@ __all__ = ['getpwuid', 'getpwnam', 'getpwall'] from os import _name, _posix_impl +from org.python.core.Py import newString if _name == 'nt': raise ImportError, 'pwd module not supported on Windows' @@ -28,7 +29,10 @@ 'pw_dir', 'pw_shell'] def __new__(cls, pwd): - return tuple.__new__(cls, (getattr(pwd, attr) for attr in cls.attrs)) + pwd = (newString(pwd.loginName), newString(pwd.password), pwd.UID, + pwd.GID, newString(pwd.GECOS), newString(pwd.home), + newString(pwd.shell)) + return tuple.__new__(cls, pwd) def __getattr__(self, attr): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |