components/policy/tools/template_writers/policy_template_generator.py
def _ProcessPolicy(self, policy):
    '''Processes localized message strings in a policy or a group.
     Also breaks up the content of 'supported_on' attribute into a list.

    Args:
      policy: The data structure of the policy or group, that will get message
        strings here.
    '''
    if policy['type'] != 'atomic_group':
      policy['desc'] = self._ImportMessage(policy['desc'])
    policy['caption'] = self._ImportMessage(policy['caption'])
    if 'label' in policy:
      policy['label'] = self._ImportMessage(policy['label'])
    if 'arc_support' in policy:
      policy['arc_support'] = self._ImportMessage(policy['arc_support'])

    if IsGroupOrAtomicGroup(policy):
      self._ProcessPolicyList(policy['policies'])
    elif policy['type'] in ('string-enum', 'int-enum', 'string-enum-list'):
      # Iterate through all the items of an enum-type policy, and add captions.
      for item in policy['items']:
        item['caption'] = self._ImportMessage(item['caption'])
        if 'supported_on' in item:
          item['supported_on'] = self._ProcessSupportedOn(item['supported_on'])
    if not IsGroupOrAtomicGroup(policy):
      if not 'label' in policy:
        # If 'label' is not specified, then it defaults to 'caption':
        policy['label'] = policy['caption']
      policy['supported_on'] = self._ProcessSupportedOn(
          policy.get('supported_on', []))
      policy['future_on'] = self._ProcessFutureOn(policy.get('future_on', []))
Processes localized message strings in a policy or a group.
     Also breaks up the content of 'supported_on' attribute into a list.

    Args:
      policy: The data structure of the policy or group, that will get message
        strings here.
    
Processes localized message strings in a policy or a group.
Also breaks up the content of 'supported_on' attribute into a list.
Processes localized message strings in a policy or a group . Also breaks up the content of ' supported_on ' attribute into a list .
def _ProcessPolicy(self, policy):
    if policy['type'] != 'atomic_group':
      policy['desc'] = self._ImportMessage(policy['desc'])
    policy['caption'] = self._ImportMessage(policy['caption'])
    if 'label' in policy:
      policy['label'] = self._ImportMessage(policy['label'])
    if 'arc_support' in policy:
      policy['arc_support'] = self._ImportMessage(policy['arc_support'])
    if IsGroupOrAtomicGroup(policy):
      self._ProcessPolicyList(policy['policies'])
    elif policy['type'] in ('string-enum', 'int-enum', 'string-enum-list'):
      for item in policy['items']:
        item['caption'] = self._ImportMessage(item['caption'])
        if 'supported_on' in item:
          item['supported_on'] = self._ProcessSupportedOn(item['supported_on'])
    if not IsGroupOrAtomicGroup(policy):
      if not 'label' in policy:
        policy['label'] = policy['caption']
      policy['supported_on'] = self._ProcessSupportedOn(
          policy.get('supported_on', []))
      policy['future_on'] = self._ProcessFutureOn(policy.get('future_on', []))
def _ProcessPolicy ( self , policy ) : if policy [ 'type' ] != 'atomic_group' : policy [ 'desc' ] = self . _ImportMessage ( policy [ 'desc' ] ) policy [ 'caption' ] = self . _ImportMessage ( policy [ 'caption' ] ) if 'label' in policy : policy [ 'label' ] = self . _ImportMessage ( policy [ 'label' ] ) if 'arc_support' in policy : policy [ 'arc_support' ] = self . _ImportMessage ( policy [ 'arc_support' ] ) if IsGroupOrAtomicGroup ( policy ) : self . _ProcessPolicyList ( policy [ 'policies' ] ) elif policy [ 'type' ] in ( 'string-enum' , 'int-enum' , 'string-enum-list' ) : for item in policy [ 'items' ] : item [ 'caption' ] = self . _ImportMessage ( item [ 'caption' ] ) if 'supported_on' in item : item [ 'supported_on' ] = self . _ProcessSupportedOn ( item [ 'supported_on' ] ) if not IsGroupOrAtomicGroup ( policy ) : if not 'label' in policy : policy [ 'label' ] = policy [ 'caption' ] policy [ 'supported_on' ] = self . _ProcessSupportedOn ( policy . get ( 'supported_on' , [ ] ) ) policy [ 'future_on' ] = self . _ProcessFutureOn ( policy . get ( 'future_on' , [ ] ) )
Processes localized message strings in a policy or a group.
Processes localized message strings in a policy or a group .
'''Processes localized message strings in a policy or a group.
     Also breaks up the content of 'supported_on' attribute into a list.

    Args:
      policy: The data structure of the policy or group, that will get message
        strings here.
    ''' # Iterate through all the items of an enum-type policy, and add captions. # If 'label' is not specified, then it defaults to 'caption':
self
policy
The data structure of the policy or group, that will get message
strings here.
The data structure of the policy or group that will get message strings here .