components/policy/tools/template_writers/writers/doc_writer.py
def _AddExample(self, parent, policy):
    '''Adds the HTML DOM representation of the example value of a policy to
    a DOM node. It is simple text for boolean policies, like
    '0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)'
    in case of boolean policies, but it may also contain other HTML elements.
    (See method _AddListExample.)

    Args:
      parent: The DOM node for which the example will be added.
      policy: The data structure of a policy.

    Raises:
      Exception: If the type of the policy is unknown or the example value
        of the policy is out of its expected range.
    '''
    example_value = policy['example_value']
    policy_type = policy['type']
    if policy_type == 'main':
      pieces = []
      if self.IsPolicySupportedOnWindows(policy) or \
         self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
                                          management='active_directory'):
        value = '0x00000001' if example_value else '0x00000000'
        pieces.append(value + ' (Windows)')
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux'):
        value = 'true' if example_value else 'false'
        pieces.append(value + ' (Linux)')
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'android'):
        value = 'true' if example_value else 'false'
        pieces.append(value + ' (Android)')
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
        value = '<true />' if example_value else '<false />'
        pieces.append(value + ' (Mac)')
      self.AddText(parent, ', '.join(pieces))
    elif policy_type == 'string':
      self.AddText(parent, '"%s"' % example_value)
    elif policy_type in ('int', 'int-enum'):
      pieces = []
      if self.IsPolicySupportedOnWindows(policy) or \
         self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
                                          management='active_directory'):
        pieces.append('0x%08x (Windows)' % example_value)
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux'):
        pieces.append('%d (Linux)' % example_value)
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'android'):
        pieces.append('%d (Android)' % example_value)
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
        pieces.append('%d (Mac)' % example_value)
      self.AddText(parent, ', '.join(pieces))
    elif policy_type == 'string-enum':
      self.AddText(parent, '"%s"' % (example_value))
    elif policy_type in ('list', 'string-enum-list'):
      self._AddListExample(parent, policy)
    elif policy_type in ('dict', 'external'):
      self._AddDictionaryExample(parent, policy)
    else:
      raise Exception('Unknown policy type: ' + policy_type)

    if self.IsPolicySupportedOnWindows(policy):
      self._AddIntuneExample(parent, policy)
Adds the HTML DOM representation of the example value of a policy to
    a DOM node. It is simple text for boolean policies, like
    '0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)'
    in case of boolean policies, but it may also contain other HTML elements.
    (See method _AddListExample.)

    Args:
      parent: The DOM node for which the example will be added.
      policy: The data structure of a policy.

    Raises:
      Exception: If the type of the policy is unknown or the example value
        of the policy is out of its expected range.
    
Adds the HTML DOM representation of the example value of a policy to
a DOM node. It is simple text for boolean policies, like
'0x00000001 (Windows), true (Linux), true (Android),  (Mac)'
in case of boolean policies, but it may also contain other HTML elements.
Adds the HTML DOM representation of the example value of a policy to a DOM node . It is simple text for boolean policies like ' 0x00000001 ( Windows ) true ( Linux ) true ( Android ) ( Mac ) ' in case of boolean policies but it may also contain other HTML elements .
def _AddExample(self, parent, policy):
    example_value = policy['example_value']
    policy_type = policy['type']
    if policy_type == 'main':
      pieces = []
      if self.IsPolicySupportedOnWindows(policy) or \
         self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
                                          management='active_directory'):
        value = '0x00000001' if example_value else '0x00000000'
        pieces.append(value + ' (Windows)')
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux'):
        value = 'true' if example_value else 'false'
        pieces.append(value + ' (Linux)')
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'android'):
        value = 'true' if example_value else 'false'
        pieces.append(value + ' (Android)')
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
        value = '<true />' if example_value else '<false />'
        pieces.append(value + ' (Mac)')
      self.AddText(parent, ', '.join(pieces))
    elif policy_type == 'string':
      self.AddText(parent, '"%s"' % example_value)
    elif policy_type in ('int', 'int-enum'):
      pieces = []
      if self.IsPolicySupportedOnWindows(policy) or \
         self.IsPolicyOrItemSupportedOnPlatform(policy, 'chrome_os',
                                          management='active_directory'):
        pieces.append('0x%08x (Windows)' % example_value)
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'linux'):
        pieces.append('%d (Linux)' % example_value)
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'android'):
        pieces.append('%d (Android)' % example_value)
      if self.IsPolicyOrItemSupportedOnPlatform(policy, 'mac'):
        pieces.append('%d (Mac)' % example_value)
      self.AddText(parent, ', '.join(pieces))
    elif policy_type == 'string-enum':
      self.AddText(parent, '"%s"' % (example_value))
    elif policy_type in ('list', 'string-enum-list'):
      self._AddListExample(parent, policy)
    elif policy_type in ('dict', 'external'):
      self._AddDictionaryExample(parent, policy)
    else:
      raise Exception('Unknown policy type: ' + policy_type)
    if self.IsPolicySupportedOnWindows(policy):
      self._AddIntuneExample(parent, policy)
def _AddExample ( self , parent , policy ) : example_value = policy [ 'example_value' ] policy_type = policy [ 'type' ] if policy_type == 'main' : pieces = [ ] if self . IsPolicySupportedOnWindows ( policy ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'chrome_os' , management = 'active_directory' ) : value = '0x00000001' if example_value else '0x00000000' pieces . append ( value + ' (Windows)' ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'linux' ) : value = 'true' if example_value else 'false' pieces . append ( value + ' (Linux)' ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'android' ) : value = 'true' if example_value else 'false' pieces . append ( value + ' (Android)' ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'mac' ) : value = '<true />' if example_value else '<false />' pieces . append ( value + ' (Mac)' ) self . AddText ( parent , ', ' . join ( pieces ) ) elif policy_type == 'string' : self . AddText ( parent , '"%s"' % example_value ) elif policy_type in ( 'int' , 'int-enum' ) : pieces = [ ] if self . IsPolicySupportedOnWindows ( policy ) or self . IsPolicyOrItemSupportedOnPlatform ( policy , 'chrome_os' , management = 'active_directory' ) : pieces . append ( '0x%08x (Windows)' % example_value ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'linux' ) : pieces . append ( '%d (Linux)' % example_value ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'android' ) : pieces . append ( '%d (Android)' % example_value ) if self . IsPolicyOrItemSupportedOnPlatform ( policy , 'mac' ) : pieces . append ( '%d (Mac)' % example_value ) self . AddText ( parent , ', ' . join ( pieces ) ) elif policy_type == 'string-enum' : self . AddText ( parent , '"%s"' % ( example_value ) ) elif policy_type in ( 'list' , 'string-enum-list' ) : self . _AddListExample ( parent , policy ) elif policy_type in ( 'dict' , 'external' ) : self . _AddDictionaryExample ( parent , policy ) else : raise Exception ( 'Unknown policy type: ' + policy_type ) if self . IsPolicySupportedOnWindows ( policy ) : self . _AddIntuneExample ( parent , policy )
Adds the HTML DOM representation of the example value of a policy to
a DOM node.
Adds the HTML DOM representation of the example value of a policy to a DOM node .
'''Adds the HTML DOM representation of the example value of a policy to
    a DOM node. It is simple text for boolean policies, like
    '0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)'
    in case of boolean policies, but it may also contain other HTML elements.
    (See method _AddListExample.)

    Args:
      parent: The DOM node for which the example will be added.
      policy: The data structure of a policy.

    Raises:
      Exception: If the type of the policy is unknown or the example value
        of the policy is out of its expected range.
    '''
If the type of the policy is unknown or the example value
of the policy is out of its expected range.
If the type of the policy is unknown or the example value of the policy is out of its expected range .
Exception
self
parent
The DOM node for which the example will be added.
The DOM node for which the example will be added .
policy
The data structure of a policy.
The data structure of a policy .