def _fixNS(self, namespace):
        """Convert an input value into the internally used values of
        this object

        @param namespace: The string or constant to convert
        @type namespace: str or unicode or BARE_NS or OPENID_NS
        """
        if isinstance(namespace, bytes):
            namespace = str(namespace, encoding="utf-8")

        if namespace == OPENID_NS:
            if self._openid_ns_uri is None:
                raise UndefinedOpenIDNamespace('OpenID namespace not set')
            else:
                namespace = self._openid_ns_uri

        if namespace != BARE_NS and not isinstance(namespace, str):
            raise TypeError(
                "Namespace must be BARE_NS, OPENID_NS or a string. got %r" %
                (namespace, ))

        if namespace != BARE_NS and ':' not in namespace:
            fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r'
            warnings.warn(fmt % (namespace, ), DeprecationWarning)

            if namespace == 'sreg':
                fmt = 'Using %r instead of "sreg" as namespace'
                warnings.warn(
                    fmt % (SREG_URI, ),
                    DeprecationWarning, )
                return SREG_URI

        return namespace
def _fixNS ( self , namespace ) : if isinstance ( namespace , bytes ) : namespace = str ( namespace , encoding = "utf-8" ) if namespace == OPENID_NS : if self . _openid_ns_uri is None : raise UndefinedOpenIDNamespace ( 'OpenID namespace not set' ) else : namespace = self . _openid_ns_uri if namespace != BARE_NS and not isinstance ( namespace , str ) : raise TypeError ( "Namespace must be BARE_NS, OPENID_NS or a string. got %r" % ( namespace , ) ) if namespace != BARE_NS and ':' not in namespace : fmt = 'OpenID 2.0 namespace identifiers SHOULD be URIs. Got %r' warnings . warn ( fmt % ( namespace , ) , DeprecationWarning ) if namespace == 'sreg' : fmt = 'Using %r instead of "sreg" as namespace' warnings . warn ( fmt % ( SREG_URI , ) , DeprecationWarning , ) return SREG_URI return namespace
Convert an input value into the internally used values of
        this object

        @param namespace: The string or constant to convert
        @type namespace: str or unicode or BARE_NS or OPENID_NS