def __init__(self, url_in=''):
        """ 
        __init__(url_in='')

        Create a new Url object from a string or another Url object.
        """

        if not url_in:
            url_in = ""

        self._urlobj = urlparse.urlparse(str(url_in), allow_fragments=True)
        self._renew_url()
    def __init__(self, url_in=''):
        """ 
        __init__(url_in='')

        Create a new Url object from a string or another Url object.
        """

        if  not url_in :
            url_in = ""

        self._urlobj = urlparse.urlparse (str (url_in), allow_fragments=True)
        self._renew_url ()
Exemple #3
0
    def _renew_url (self, scheme='', netloc='', path='', 
                          params='', query='',  fragment='') :

        # always normalize the path
        if  path :
            path = os.path.normpath (path)

        newurl = urlparse.urlunparse ((scheme   or self._urlobj.scheme,
                                       netloc   or self._urlobj.netloc,
                                       path     or self._urlobj.path,
                                       params   or self._urlobj.params,
                                       query    or self._urlobj.query,
                                       fragment or self._urlobj.fragment))

        self._urlobj = urlparse.urlparse (newurl)
    def _renew_url (self, scheme='', netloc='', path='', 
                          params='', query='',  fragment='', force_path=False) :

        # always normalize the path.  
        path = self.normpath(path)

        if  force_path :
            forced_path = path or ''
        else :
            forced_path = path or self._urlobj.path


        newurl = urlparse.urlunparse ((scheme   or self._urlobj.scheme,
                                       netloc   or self._urlobj.netloc,
                                       forced_path,
                                       params   or self._urlobj.params,
                                       query    or self._urlobj.query,
                                       fragment or self._urlobj.fragment))

        self._urlobj = urlparse.urlparse (newurl, allow_fragments=True)
Exemple #5
0
    def _renew_url (self, scheme='', netloc='', path='', 
                          params='', query='',  fragment='', force_path=False) :

        # always normalize the path.  
        path = self.normpath(path)

        if  force_path :
            forced_path = path or ''
        else :
            forced_path = path or self._urlobj.path


        newurl = urlparse.urlunparse ((scheme   or self._urlobj.scheme,
                                       netloc   or self._urlobj.netloc,
                                       forced_path,
                                       params   or self._urlobj.params,
                                       query    or self._urlobj.query,
                                       fragment or self._urlobj.fragment))

        self._urlobj = urlparse.urlparse (newurl, allow_fragments=True)