(self)
Ensure that owner and ownerDomain are set to sane values.
Ensure that owner and ownerDomain are set to sane values.
Ensure that owner and ownerDomain are set to sane values .
def _NormalizeOwnerInformation(self):
    """Ensure that owner and ownerDomain are set to sane values."""
    owner_domain = self.get('ownerDomain', '')
    if not owner_domain:
      root_url = self.get('rootUrl')
      if root_url:
        owner_domain = urlparse.urlparse(root_url).hostname
        # Normalize google domains.
        if any(owner_domain.endswith(d) for d in _RECOGNIZED_GOOGLE_DOMAINS):
          owner_domain = 'google.com'
    if owner_domain:
      owner_domain = utilities.SanitizeDomain(owner_domain)
    else:
      owner_domain = _DEFAULT_OWNER_DOMAIN

    self.SetTemplateValue('ownerDomain', owner_domain)
    if not self.get('ownerName'):
      if owner_domain == _DEFAULT_OWNER_DOMAIN:
        owner_name = _DEFAULT_OWNER_NAME
      else:
        owner_name = owner_domain.replace('.', '_')
      self.SetTemplateValue('ownerName', owner_name)
    if not self.get('owner'):
      self.SetTemplateValue('owner', self['ownerName'].lower())
def _NormalizeOwnerInformation ( self ) : owner_domain = self . get ( 'ownerDomain' , '' ) if not owner_domain : root_url = self . get ( 'rootUrl' ) if root_url : owner_domain = urlparse . urlparse ( root_url ) . hostname # Normalize google domains. if any ( owner_domain . endswith ( d ) for d in _RECOGNIZED_GOOGLE_DOMAINS ) : owner_domain = 'google.com' if owner_domain : owner_domain = utilities . SanitizeDomain ( owner_domain ) else : owner_domain = _DEFAULT_OWNER_DOMAIN self . SetTemplateValue ( 'ownerDomain' , owner_domain ) if not self . get ( 'ownerName' ) : if owner_domain == _DEFAULT_OWNER_DOMAIN : owner_name = _DEFAULT_OWNER_NAME else : owner_name = owner_domain . replace ( '.' , '_' ) self . SetTemplateValue ( 'ownerName' , owner_name ) if not self . get ( 'owner' ) : self . SetTemplateValue ( 'owner' , self [ 'ownerName' ] . lower ( ) )