parameters: (self, add_missing_info=False, error_on_unknown_keys=False)
docstring: Validate the content of the bundle. Raise an Error if an invalid or
         missing field is found.
  
      Args:
        error_on_unknown_keys: If True, raise an Error when unknown keys are
        found in the bundle.
docstring_summary: Validate the content of the bundle. Raise an Error if an invalid or
         missing field is found.
docstring_tokens: Validate the content of the bundle . Raise an Error if an invalid or missing field is found .
function: def Validate(self, add_missing_info=False, error_on_unknown_keys=False):
      """Validate the content of the bundle. Raise an Error if an invalid or
         missing field is found.
  
      Args:
        error_on_unknown_keys: If True, raise an Error when unknown keys are
        found in the bundle.
      """
      # Check required fields.
      if not self.get(NAME_KEY):
        raise Error('Bundle has no name')
      if self.get(REVISION_KEY) == None:
        raise Error('Bundle "%s" is missing a revision number' % self[NAME_KEY])
      if self.get(VERSION_KEY) == None:
        raise Error('Bundle "%s" is missing a version number' % self[NAME_KEY])
      if not self.get('description'):
        raise Error('Bundle "%s" is missing a description' % self[NAME_KEY])
      if not self.get('stability'):
        raise Error('Bundle "%s" is missing stability info' % self[NAME_KEY])
      if self.get('recommended') == None:
        raise Error('Bundle "%s" is missing the recommended field' %
                    self[NAME_KEY])
      # Check specific values
      if self['stability'] not in STABILITY_LITERALS:
        raise Error('Bundle "%s" has invalid stability field: "%s"' %
                    (self[NAME_KEY], self['stability']))
      if self['recommended'] not in YES_NO_LITERALS:
        raise Error(
            'Bundle "%s" has invalid recommended field: "%s"' %
            (self[NAME_KEY], self['recommended']))
      # Verify that all key names are valid.
      if error_on_unknown_keys:
        for key in self:
          if key not in VALID_BUNDLES_KEYS:
            raise Error('Bundle "%s" has invalid attribute "%s"' %
                        (self[NAME_KEY], key))
      # Validate the archives
      for archive in self[ARCHIVES_KEY]:
        if add_missing_info and 'size' not in archive:
          archive.UpdateVitals(self[REVISION_KEY])
        archive.Validate(error_on_unknown_keys)
function_tokens: def Validate ( self , add_missing_info = False , error_on_unknown_keys = False ) : # Check required fields. if not self . get ( NAME_KEY ) : raise Error ( 'Bundle has no name' ) if self . get ( REVISION_KEY ) == None : raise Error ( 'Bundle "%s" is missing a revision number' % self [ NAME_KEY ] ) if self . get ( VERSION_KEY ) == None : raise Error ( 'Bundle "%s" is missing a version number' % self [ NAME_KEY ] ) if not self . get ( 'description' ) : raise Error ( 'Bundle "%s" is missing a description' % self [ NAME_KEY ] ) if not self . get ( 'stability' ) : raise Error ( 'Bundle "%s" is missing stability info' % self [ NAME_KEY ] ) if self . get ( 'recommended' ) == None : raise Error ( 'Bundle "%s" is missing the recommended field' % self [ NAME_KEY ] ) # Check specific values if self [ 'stability' ] not in STABILITY_LITERALS : raise Error ( 'Bundle "%s" has invalid stability field: "%s"' % ( self [ NAME_KEY ] , self [ 'stability' ] ) ) if self [ 'recommended' ] not in YES_NO_LITERALS : raise Error ( 'Bundle "%s" has invalid recommended field: "%s"' % ( self [ NAME_KEY ] , self [ 'recommended' ] ) ) # Verify that all key names are valid. if error_on_unknown_keys : for key in self : if key not in VALID_BUNDLES_KEYS : raise Error ( 'Bundle "%s" has invalid attribute "%s"' % ( self [ NAME_KEY ] , key ) ) # Validate the archives for archive in self [ ARCHIVES_KEY ] : if add_missing_info and 'size' not in archive : archive . UpdateVitals ( self [ REVISION_KEY ] ) archive . Validate ( error_on_unknown_keys )