(self, other)
Return true if this url is equivalent to another
Return true if this url is equivalent to another
Return true if this url is equivalent to another
def equiv(self, other):
        '''Return true if this url is equivalent to another'''
        if isinstance(other, string_types[0]):
            _other = self.parse(other, 'utf-8')
        else:
            _other = self.parse(other.utf8(), 'utf-8')

        _self = self.parse(self.utf8(), 'utf-8')
        _self.lower().canonical().defrag().abspath().escape().punycode()
        _other.lower().canonical().defrag().abspath().escape().punycode()

        result = (
            _self._scheme == _other._scheme and
            _self._host == _other._host and
            _self._path == _other._path and
            _self._params == _other._params and
            _self._query == _other._query)

        if result:
            if _self._port and not _other._port:
                # Make sure _self._port is the default for the scheme
                return _self._port == PORTS.get(_self._scheme, None)
            elif _other._port and not _self._port:
                # Make sure _other._port is the default for the scheme
                return _other._port == PORTS.get(_other._scheme, None)
            else:
                return _self._port == _other._port
        else:
            return False
def equiv ( self , other ) : if isinstance ( other , string_types [ 0 ] ) : _other = self . parse ( other , 'utf-8' ) else : _other = self . parse ( other . utf8 ( ) , 'utf-8' ) _self = self . parse ( self . utf8 ( ) , 'utf-8' ) _self . lower ( ) . canonical ( ) . defrag ( ) . abspath ( ) . escape ( ) . punycode ( ) _other . lower ( ) . canonical ( ) . defrag ( ) . abspath ( ) . escape ( ) . punycode ( ) result = ( _self . _scheme == _other . _scheme and _self . _host == _other . _host and _self . _path == _other . _path and _self . _params == _other . _params and _self . _query == _other . _query ) if result : if _self . _port and not _other . _port : # Make sure _self._port is the default for the scheme return _self . _port == PORTS . get ( _self . _scheme , None ) elif _other . _port and not _self . _port : # Make sure _other._port is the default for the scheme return _other . _port == PORTS . get ( _other . _scheme , None ) else : return _self . _port == _other . _port else : return False