(dstype, objectname=None)
return []
List a directory from DS.

  dscl -plist . -list returns text, not a plist, so no -plist here.

  Args:
    dstype: The type of objects to list. user, group.
    objectname: the object to query.
  Returns:
    a list of users
  Raises:
    ds.DSException: Cannot query DirectoryServices
List a directory from DS.
List a directory from DS .
def DSList(dstype, objectname=None):
  """List a directory from DS.

  dscl -plist . -list returns text, not a plist, so no -plist here.

  Args:
    dstype: The type of objects to list. user, group.
    objectname: the object to query.
  Returns:
    a list of users
  Raises:
    ds.DSException: Cannot query DirectoryServices
  """
  ds_path = '/%ss' % dstype.capitalize()
  if objectname:
    ds_path = ds_path + '/' + objectname
  cmd = [_DSCL, '.', '-list', ds_path]
  stdout, stderr, rc = gmacpyutil.RunProcess(cmd)
  if rc:
    raise DSException('Cannot list %s: %s' % (ds_path, stderr))
  if stdout:
    return stdout.rstrip('\n').split('\n')
  return []
def DSList ( dstype , objectname = None ) : ds_path = '/%ss' % dstype . capitalize ( ) if objectname : ds_path = ds_path + '/' + objectname cmd = [ _DSCL , '.' , '-list' , ds_path ] stdout , stderr , rc = gmacpyutil . RunProcess ( cmd ) if rc : raise DSException ( 'Cannot list %s: %s' % ( ds_path , stderr ) ) if stdout : return stdout . rstrip ( '\n' ) . split ( '\n' ) return [ ]