(dstype, objectname, attribute=None, value=None)
DirectoryServices attribute set.

  This uses dscl create, which overwrites any existing objects or attributes.

  Args:
    dstype: The type of objects to query. user, group.
    objectname: the object to set.
    attribute: the optional attribute to set.
    value: the optional value to set, only handles strings and simple lists
  Raises:
    DSException: Cannot modify DirectoryServices.
DirectoryServices attribute set.
DirectoryServices attribute set .
def DSSet(dstype, objectname, attribute=None, value=None):
  """DirectoryServices attribute set.

  This uses dscl create, which overwrites any existing objects or attributes.

  Args:
    dstype: The type of objects to query. user, group.
    objectname: the object to set.
    attribute: the optional attribute to set.
    value: the optional value to set, only handles strings and simple lists
  Raises:
    DSException: Cannot modify DirectoryServices.
  """
  ds_path = '/%ss/%s' % (dstype.capitalize(), objectname)
  cmd = [_DSCL, '.', '-create', ds_path]
  if attribute:
    cmd.append(attribute)
    if value:
      if type(value) == type(list()):
        cmd.extend(value)
      else:
        cmd.append(value)
  (unused_stdout, stderr, returncode) = gmacpyutil.RunProcess(cmd)
  if returncode:
    raise DSException('Cannot set %s for %s: %s' % (attribute,
                                                    ds_path,
                                                    stderr))
def DSSet ( dstype , objectname , attribute = None , value = None ) : ds_path = '/%ss/%s' % ( dstype . capitalize ( ) , objectname ) cmd = [ _DSCL , '.' , '-create' , ds_path ] if attribute : cmd . append ( attribute ) if value : if type ( value ) == type ( list ( ) ) : cmd . extend ( value ) else : cmd . append ( value ) ( unused_stdout , stderr , returncode ) = gmacpyutil . RunProcess ( cmd ) if returncode : raise DSException ( 'Cannot set %s for %s: %s' % ( attribute , ds_path , stderr ) )