components/policy/tools/template_writers/writers/admx_writer.py
def _WritePolicy(self, policy, name, key, parent):
    '''Generates ADMX elements for a Policy.'''
    policies_elem = self._active_policies_elem
    policy_name = policy['name']
    attributes = {
        'name': name,
        'class': self.GetClass(policy),
        'displayName': self._AdmlString(policy_name),
        'explainText': self._AdmlStringExplain(policy_name),
        'presentation': self._AdmlPresentation(policy_name),
        'key': key,
    }
    is_win7_only = self.IsPolicyOnWin7Only(policy)
    supported_key = ('win_supported_os_win7'
                     if is_win7_only else 'win_supported_os')
    supported_on_text = self.config[supported_key]

    # Store the current "policy" AMDX element in self for later use by the
    # WritePolicy method.
    policy_elem = self.AddElement(policies_elem, 'policy', attributes)
    self.AddElement(policy_elem, 'parentCategory', {'ref': parent})
    self.AddElement(policy_elem, 'supportedOn', {'ref': supported_on_text})

    element_type = self._GetAdmxElementType(policy)
    if element_type == AdmxElementType.MAIN:
      self.AddAttribute(policy_elem, 'valueName', policy_name)
      self._AddMainPolicy(policy_elem)
    elif element_type == AdmxElementType.STRING:
      parent = self._GetElements(policy_elem)
      self._AddStringPolicy(parent, policy_name)
    elif element_type == AdmxElementType.MULTI_STRING:
      parent = self._GetElements(policy_elem)
      self._AddMultiStringPolicy(parent, policy_name)
    elif element_type == AdmxElementType.INT:
      parent = self._GetElements(policy_elem)
      self._AddIntPolicy(parent, policy)
    elif element_type == AdmxElementType.ENUM:
      parent = self._GetElements(policy_elem)
      self._AddEnumPolicy(parent, policy)
    elif element_type == AdmxElementType.LIST:
      parent = self._GetElements(policy_elem)
      self._AddListPolicy(parent, key, policy_name)
    elif element_type == AdmxElementType.GROUP:
      pass
    else:
      raise Exception('Unknown element type %s.' % element_type)
Generates ADMX elements for a Policy.
Generates ADMX elements for a Policy.
Generates ADMX elements for a Policy .
def _WritePolicy(self, policy, name, key, parent):
    policies_elem = self._active_policies_elem
    policy_name = policy['name']
    attributes = {
        'name': name,
        'class': self.GetClass(policy),
        'displayName': self._AdmlString(policy_name),
        'explainText': self._AdmlStringExplain(policy_name),
        'presentation': self._AdmlPresentation(policy_name),
        'key': key,
    }
    is_win7_only = self.IsPolicyOnWin7Only(policy)
    supported_key = ('win_supported_os_win7'
                     if is_win7_only else 'win_supported_os')
    supported_on_text = self.config[supported_key]
    policy_elem = self.AddElement(policies_elem, 'policy', attributes)
    self.AddElement(policy_elem, 'parentCategory', {'ref': parent})
    self.AddElement(policy_elem, 'supportedOn', {'ref': supported_on_text})
    element_type = self._GetAdmxElementType(policy)
    if element_type == AdmxElementType.MAIN:
      self.AddAttribute(policy_elem, 'valueName', policy_name)
      self._AddMainPolicy(policy_elem)
    elif element_type == AdmxElementType.STRING:
      parent = self._GetElements(policy_elem)
      self._AddStringPolicy(parent, policy_name)
    elif element_type == AdmxElementType.MULTI_STRING:
      parent = self._GetElements(policy_elem)
      self._AddMultiStringPolicy(parent, policy_name)
    elif element_type == AdmxElementType.INT:
      parent = self._GetElements(policy_elem)
      self._AddIntPolicy(parent, policy)
    elif element_type == AdmxElementType.ENUM:
      parent = self._GetElements(policy_elem)
      self._AddEnumPolicy(parent, policy)
    elif element_type == AdmxElementType.LIST:
      parent = self._GetElements(policy_elem)
      self._AddListPolicy(parent, key, policy_name)
    elif element_type == AdmxElementType.GROUP:
      pass
    else:
      raise Exception('Unknown element type %s.' % element_type)
def _WritePolicy ( self , policy , name , key , parent ) : policies_elem = self . _active_policies_elem policy_name = policy [ 'name' ] attributes = { 'name' : name , 'class' : self . GetClass ( policy ) , 'displayName' : self . _AdmlString ( policy_name ) , 'explainText' : self . _AdmlStringExplain ( policy_name ) , 'presentation' : self . _AdmlPresentation ( policy_name ) , 'key' : key , } is_win7_only = self . IsPolicyOnWin7Only ( policy ) supported_key = ( 'win_supported_os_win7' if is_win7_only else 'win_supported_os' ) supported_on_text = self . config [ supported_key ] policy_elem = self . AddElement ( policies_elem , 'policy' , attributes ) self . AddElement ( policy_elem , 'parentCategory' , { 'ref' : parent } ) self . AddElement ( policy_elem , 'supportedOn' , { 'ref' : supported_on_text } ) element_type = self . _GetAdmxElementType ( policy ) if element_type == AdmxElementType . MAIN : self . AddAttribute ( policy_elem , 'valueName' , policy_name ) self . _AddMainPolicy ( policy_elem ) elif element_type == AdmxElementType . STRING : parent = self . _GetElements ( policy_elem ) self . _AddStringPolicy ( parent , policy_name ) elif element_type == AdmxElementType . MULTI_STRING : parent = self . _GetElements ( policy_elem ) self . _AddMultiStringPolicy ( parent , policy_name ) elif element_type == AdmxElementType . INT : parent = self . _GetElements ( policy_elem ) self . _AddIntPolicy ( parent , policy ) elif element_type == AdmxElementType . ENUM : parent = self . _GetElements ( policy_elem ) self . _AddEnumPolicy ( parent , policy ) elif element_type == AdmxElementType . LIST : parent = self . _GetElements ( policy_elem ) self . _AddListPolicy ( parent , key , policy_name ) elif element_type == AdmxElementType . GROUP : pass else : raise Exception ( 'Unknown element type %s.' % element_type )
Generates ADMX elements for a Policy.
Generates ADMX elements for a Policy .
'''Generates ADMX elements for a Policy.''' # Store the current "policy" AMDX element in self for later use by the # WritePolicy method.
self
policy
name
key
parent