components/policy/tools/template_writers/writers/doc_writer.py
def _AddPolicyDetails(self, parent, policy):
    '''Adds the list of attributes of a policy to the HTML DOM node parent.
    It will have the form:
    <dl>
      <dt>Attribute:</dt><dd>Description</dd>
      ...
    </dl>

    Args:
      parent: A DOM element for which the list will be added.
      policy: The data structure of the policy.
    '''

    dl = self.AddElement(parent, 'dl')
    data_type = [self._TYPE_MAP[policy['type']]]
    qualified_types = []
    is_complex_policy = False
    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') and
        self._RESTRICTION_TYPE_MAP.get(policy['type'], None)):
      qualified_types.append(
          'Android:%s' % self._RESTRICTION_TYPE_MAP[policy['type']])
      if policy['type'] in ('dict', 'external', 'list'):
        is_complex_policy = True
    if ((self.IsPolicySupportedOnWindows(policy) or
         self.IsPolicyOrItemSupportedOnPlatform(
             policy, 'chrome_os', management='active_directory')) and
        self._REG_TYPE_MAP.get(policy['type'], None)):
      qualified_types.append('Windows:%s' % self._REG_TYPE_MAP[policy['type']])
      if policy['type'] in ('dict', 'external'):
        is_complex_policy = True
    if qualified_types:
      data_type.append('[%s]' % ', '.join(qualified_types))
      if is_complex_policy:
        data_type.append(
            '(%s)' % self.GetLocalizedMessage('complex_policies_on_windows'))
    self._AddPolicyAttribute(dl, 'data_type', ' '.join(data_type))
    if self.IsPolicySupportedOnWindows(policy):
      registry_key_name = self._GetRegistryKeyName(policy, True)
      self._AddPolicyAttribute(dl, 'win_reg_loc',
                               registry_key_name + '\\' + policy['name'],
                               ['.monospace'])
      self._AddPolicyAttribute(dl, 'oma_uri', self._GetOmaUriPath(policy),
                               ['.monospace'])

    if self.IsPolicyOrItemSupportedOnPlatform(
        policy, 'chrome_os', management='active_directory'):
      key_name = self._GetRegistryKeyName(policy, False)
      self._AddPolicyAttribute(dl, 'chrome_os_reg_loc',
                               key_name + '\\' + policy['name'], ['.monospace'])
    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux') or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac')):
      self._AddPolicyAttribute(dl, 'mac_linux_pref_name', policy['name'],
                               ['.monospace'])
    if self.IsPolicyOrItemSupportedOnPlatform(
        policy, 'android', product='chrome'):
      self._AddPolicyAttribute(dl, 'android_restriction_name', policy['name'],
                               ['.monospace'])
    if self.IsPolicyOrItemSupportedOnPlatform(
        policy, 'android', product='webview'):
      restriction_prefix = self.config['android_webview_restriction_prefix']
      self._AddPolicyAttribute(dl, 'android_webview_restriction_name',
                               restriction_prefix + policy['name'],
                               ['.monospace'])
    dd = self._AddPolicyAttribute(dl, 'supported_on')
    self._AddSupportedOnList(dd, policy['supported_on'])
    dd = self._AddPolicyAttribute(dl, 'supported_features')
    self._AddFeatures(dd, policy)
    dd = self._AddPolicyAttribute(dl, 'description')
    self._AddDescription(dd, policy)
    if 'schema' in policy:
      if self.SchemaHasRangeRestriction(policy['schema']):
        dd = self._AddPolicyAttribute(dl, 'policy_restriction')
        self._AddRangeRestrictionsList(dd, policy['schema'])
    if 'arc_support' in policy:
      dd = self._AddPolicyAttribute(dl, 'arc_support')
      self._AddParagraphs(dd, policy['arc_support'])
    if policy['type'] in ('dict', 'external') and 'schema' in policy:
      self._AddSchema(dl, policy['schema'])
    if 'validation_schema' in policy:
      self._AddSchema(dl, policy['validation_schema'])
    if 'description_schema' in policy:
      self._AddSchema(dl, policy['description_schema'])
    if 'url_schema' in policy:
      dd = self._AddPolicyAttribute(dl, 'url_schema')
      self._AddTextWithLinks(dd, policy['url_schema'])
    if (self.IsPolicySupportedOnWindows(policy) or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux') or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac') or
        self.IsPolicyOrItemSupportedOnPlatform(
            policy, 'chrome_os', management='active_directory')):
      # Don't add an example for Google cloud managed ChromeOS policies.
      dd = self._AddPolicyAttribute(dl, 'example_value')
      self._AddExample(dd, policy)
    if 'atomic_group' in policy:
      dd = self._AddPolicyAttribute(dl, 'policy_atomic_group')
      policy_group_ref = './policy-list-3/atomic_groups'
      if 'local' in self.config and self.config['local']:
        policy_group_ref = './chrome_policy_atomic_groups_list.html'
      self.AddText(dd, self.GetLocalizedMessage('policy_in_atomic_group') + ' ')
      self.AddElement(dd, 'a',
                      {'href': policy_group_ref + '#' + policy['atomic_group']},
                      policy['atomic_group'])
Adds the list of attributes of a policy to the HTML DOM node parent.
    It will have the form:
    <dl>
      <dt>Attribute:</dt><dd>Description</dd>
      ...
    </dl>

    Args:
      parent: A DOM element for which the list will be added.
      policy: The data structure of the policy.
    
Adds the list of attributes of a policy to the HTML DOM node parent.
It will have the form:

Attribute:Description

Adds the list of attributes of a policy to the HTML DOM node parent . It will have the form : Attribute : Description
def _AddPolicyDetails(self, parent, policy):
    dl = self.AddElement(parent, 'dl')
    data_type = [self._TYPE_MAP[policy['type']]]
    qualified_types = []
    is_complex_policy = False
    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') and
        self._RESTRICTION_TYPE_MAP.get(policy['type'], None)):
      qualified_types.append(
          'Android:%s' % self._RESTRICTION_TYPE_MAP[policy['type']])
      if policy['type'] in ('dict', 'external', 'list'):
        is_complex_policy = True
    if ((self.IsPolicySupportedOnWindows(policy) or
         self.IsPolicyOrItemSupportedOnPlatform(
             policy, 'chrome_os', management='active_directory')) and
        self._REG_TYPE_MAP.get(policy['type'], None)):
      qualified_types.append('Windows:%s' % self._REG_TYPE_MAP[policy['type']])
      if policy['type'] in ('dict', 'external'):
        is_complex_policy = True
    if qualified_types:
      data_type.append('[%s]' % ', '.join(qualified_types))
      if is_complex_policy:
        data_type.append(
            '(%s)' % self.GetLocalizedMessage('complex_policies_on_windows'))
    self._AddPolicyAttribute(dl, 'data_type', ' '.join(data_type))
    if self.IsPolicySupportedOnWindows(policy):
      registry_key_name = self._GetRegistryKeyName(policy, True)
      self._AddPolicyAttribute(dl, 'win_reg_loc',
                               registry_key_name + '\\' + policy['name'],
                               ['.monospace'])
      self._AddPolicyAttribute(dl, 'oma_uri', self._GetOmaUriPath(policy),
                               ['.monospace'])
    if self.IsPolicyOrItemSupportedOnPlatform(
        policy, 'chrome_os', management='active_directory'):
      key_name = self._GetRegistryKeyName(policy, False)
      self._AddPolicyAttribute(dl, 'chrome_os_reg_loc',
                               key_name + '\\' + policy['name'], ['.monospace'])
    if (self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux') or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac')):
      self._AddPolicyAttribute(dl, 'mac_linux_pref_name', policy['name'],
                               ['.monospace'])
    if self.IsPolicyOrItemSupportedOnPlatform(
        policy, 'android', product='chrome'):
      self._AddPolicyAttribute(dl, 'android_restriction_name', policy['name'],
                               ['.monospace'])
    if self.IsPolicyOrItemSupportedOnPlatform(
        policy, 'android', product='webview'):
      restriction_prefix = self.config['android_webview_restriction_prefix']
      self._AddPolicyAttribute(dl, 'android_webview_restriction_name',
                               restriction_prefix + policy['name'],
                               ['.monospace'])
    dd = self._AddPolicyAttribute(dl, 'supported_on')
    self._AddSupportedOnList(dd, policy['supported_on'])
    dd = self._AddPolicyAttribute(dl, 'supported_features')
    self._AddFeatures(dd, policy)
    dd = self._AddPolicyAttribute(dl, 'description')
    self._AddDescription(dd, policy)
    if 'schema' in policy:
      if self.SchemaHasRangeRestriction(policy['schema']):
        dd = self._AddPolicyAttribute(dl, 'policy_restriction')
        self._AddRangeRestrictionsList(dd, policy['schema'])
    if 'arc_support' in policy:
      dd = self._AddPolicyAttribute(dl, 'arc_support')
      self._AddParagraphs(dd, policy['arc_support'])
    if policy['type'] in ('dict', 'external') and 'schema' in policy:
      self._AddSchema(dl, policy['schema'])
    if 'validation_schema' in policy:
      self._AddSchema(dl, policy['validation_schema'])
    if 'description_schema' in policy:
      self._AddSchema(dl, policy['description_schema'])
    if 'url_schema' in policy:
      dd = self._AddPolicyAttribute(dl, 'url_schema')
      self._AddTextWithLinks(dd, policy['url_schema'])
    if (self.IsPolicySupportedOnWindows(policy) or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux') or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'android') or
        self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac') or
        self.IsPolicyOrItemSupportedOnPlatform(
            policy, 'chrome_os', management='active_directory')):
      dd = self._AddPolicyAttribute(dl, 'example_value')
      self._AddExample(dd, policy)
    if 'atomic_group' in policy:
      dd = self._AddPolicyAttribute(dl, 'policy_atomic_group')
      policy_group_ref = './policy-list-3/atomic_groups'
      if 'local' in self.config and self.config['local']:
        policy_group_ref = './chrome_policy_atomic_groups_list.html'
      self.AddText(dd, self.GetLocalizedMessage('policy_in_atomic_group') + ' ')
      self.AddElement(dd, 'a',
                      {'href': policy_group_ref + '#' + policy['atomic_group']},
                      policy['atomic_group'])
def _AddPolicyDetails ( self , parent , policy ) : dl = self . AddElement ( parent , 'dl' ) data_type = [ self . _TYPE_MAP [ policy [ 'type' ] ] ] qualified_types = [ ] is_complex_policy = False if ( self . IsPolicyOrItemSupportedOnPlatform ( policy , 'android' ) and self . _RESTRICTION_TYPE_MAP . get ( policy [ 'type' ] , None ) ) : qualified_types . append ( 'Android:%s' % self . _RESTRICTION_TYPE_MAP [ policy [ 'type' ] ] ) if policy [ 'type' ] in ( 'dict' , 'external' , 'list' ) : is_complex_policy = True if ( ( self . IsPolicySupportedOnWindows ( policy ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'chrome_os' , management = 'active_directory' ) ) and self . _REG_TYPE_MAP . get ( policy [ 'type' ] , None ) ) : qualified_types . append ( 'Windows:%s' % self . _REG_TYPE_MAP [ policy [ 'type' ] ] ) if policy [ 'type' ] in ( 'dict' , 'external' ) : is_complex_policy = True if qualified_types : data_type . append ( '[%s]' % ', ' . join ( qualified_types ) ) if is_complex_policy : data_type . append ( '(%s)' % self . GetLocalizedMessage ( 'complex_policies_on_windows' ) ) self . _AddPolicyAttribute ( dl , 'data_type' , ' ' . join ( data_type ) ) if self . IsPolicySupportedOnWindows ( policy ) : registry_key_name = self . _GetRegistryKeyName ( policy , True ) self . _AddPolicyAttribute ( dl , 'win_reg_loc' , registry_key_name + '\\' + policy [ 'name' ] , [ '.monospace' ] ) self . _AddPolicyAttribute ( dl , 'oma_uri' , self . _GetOmaUriPath ( policy ) , [ '.monospace' ] ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'chrome_os' , management = 'active_directory' ) : key_name = self . _GetRegistryKeyName ( policy , False ) self . _AddPolicyAttribute ( dl , 'chrome_os_reg_loc' , key_name + '\\' + policy [ 'name' ] , [ '.monospace' ] ) if ( self . IsPolicyOrItemSupportedOnPlatform ( policy , 'linux' ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'mac' ) ) : self . _AddPolicyAttribute ( dl , 'mac_linux_pref_name' , policy [ 'name' ] , [ '.monospace' ] ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'android' , product = 'chrome' ) : self . _AddPolicyAttribute ( dl , 'android_restriction_name' , policy [ 'name' ] , [ '.monospace' ] ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'android' , product = 'webview' ) : restriction_prefix = self . config [ 'android_webview_restriction_prefix' ] self . _AddPolicyAttribute ( dl , 'android_webview_restriction_name' , restriction_prefix + policy [ 'name' ] , [ '.monospace' ] ) dd = self . _AddPolicyAttribute ( dl , 'supported_on' ) self . _AddSupportedOnList ( dd , policy [ 'supported_on' ] ) dd = self . _AddPolicyAttribute ( dl , 'supported_features' ) self . _AddFeatures ( dd , policy ) dd = self . _AddPolicyAttribute ( dl , 'description' ) self . _AddDescription ( dd , policy ) if 'schema' in policy : if self . SchemaHasRangeRestriction ( policy [ 'schema' ] ) : dd = self . _AddPolicyAttribute ( dl , 'policy_restriction' ) self . _AddRangeRestrictionsList ( dd , policy [ 'schema' ] ) if 'arc_support' in policy : dd = self . _AddPolicyAttribute ( dl , 'arc_support' ) self . _AddParagraphs ( dd , policy [ 'arc_support' ] ) if policy [ 'type' ] in ( 'dict' , 'external' ) and 'schema' in policy : self . _AddSchema ( dl , policy [ 'schema' ] ) if 'validation_schema' in policy : self . _AddSchema ( dl , policy [ 'validation_schema' ] ) if 'description_schema' in policy : self . _AddSchema ( dl , policy [ 'description_schema' ] ) if 'url_schema' in policy : dd = self . _AddPolicyAttribute ( dl , 'url_schema' ) self . _AddTextWithLinks ( dd , policy [ 'url_schema' ] ) if ( self . IsPolicySupportedOnWindows ( policy ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'linux' ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'android' ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'mac' ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'chrome_os' , management = 'active_directory' ) ) : dd = self . _AddPolicyAttribute ( dl , 'example_value' ) self . _AddExample ( dd , policy ) if 'atomic_group' in policy : dd = self . _AddPolicyAttribute ( dl , 'policy_atomic_group' ) policy_group_ref = './policy-list-3/atomic_groups' if 'local' in self . config and self . config [ 'local' ] : policy_group_ref = './chrome_policy_atomic_groups_list.html' self . AddText ( dd , self . GetLocalizedMessage ( 'policy_in_atomic_group' ) + ' ' ) self . AddElement ( dd , 'a' , { 'href' : policy_group_ref + '#' + policy [ 'atomic_group' ] } , policy [ 'atomic_group' ] )
Adds the list of attributes of a policy to the HTML DOM node parent.
Adds the list of attributes of a policy to the HTML DOM node parent .
'''Adds the list of attributes of a policy to the HTML DOM node parent.
    It will have the form:
    <dl>
      <dt>Attribute:</dt><dd>Description</dd>
      ...
    </dl>

    Args:
      parent: A DOM element for which the list will be added.
      policy: The data structure of the policy.
    ''' # Don't add an example for Google cloud managed ChromeOS policies.
self
parent
A DOM element for which the list will be added.
A DOM element for which the list will be added .
policy
The data structure of the policy.
The data structure of the policy .