示例#1
0
    def split(self):
        """
        Splits the path into:

        * protocol - will always be 'ftp'
        * user - None unless a user name is part of the path
        * password - None unless a password is part of the path
        * host - always present
        * port - None unless a port number is part of the path
        * urlPath - anything after the '/' after the host and optional
          port number.
        * dirs - a list of dir names. Possibly an empty list.
        * fileBase
        * fileExt

        Caches the result, so that subsequent calls are efficient.

        Raises:
        
        * InvalidPathError if the path doesn't match the expected
          format of an FTP path. See RFC1738 and AbstractUrlPath.
        
        """
        # check for a cached version
        if self.__split is not None:
            # TODO: perform a deep copy for dirs and other lists..
            return self.__split.copy()

        # else split it and cache it
        d = self.__super.split(self)
        # TODO: later also split ;type?param#andFragments
        d.update(UrlPathUtils.splitHeirarchicalUrlPath(d['urlPath']))
        self.__split = d
        return d
示例#2
0
    def split(self):
        """
        Splits the path into:

        * protocol - will always be 'ftp'
        * user - None unless a user name is part of the path
        * password - None unless a password is part of the path
        * host - always present
        * port - None unless a port number is part of the path
        * urlPath - anything after the '/' after the host and optional
          port number.
        * dirs - a list of dir names. Possibly an empty list.
        * fileBase
        * fileExt

        Caches the result, so that subsequent calls are efficient.

        Raises:
        
        * InvalidPathError if the path doesn't match the expected
          format of an FTP path. See RFC1738 and AbstractUrlPath.
        
        """
        # check for a cached version
        if self.__split is not None:
            # TODO: perform a deep copy for dirs and other lists..
            return self.__split.copy()

        # else split it and cache it
        d=self.__super.split(self)
        # TODO: later also split ;type?param#andFragments
        d.update(UrlPathUtils.splitHeirarchicalUrlPath(d['urlPath']))
        self.__split=d
        return d
示例#3
0
    def split(self):
        """
        Splits the path into:

        * protocol - should always be 'http'
        * user - optional user. This will only be populated if the
          user is actually included in the path. That is, if an
          Authentication object has been set it will not be used to
          populate this field.
        * password - only present if a user was given and even then
          it's optional.
        * host - either an ip address or a host name. Must be present
          for a valid HTTP url.
        * port - optional port number.
        * urlPath - everything after the '/' after the host and
          optional port or None.
        * dirs - a list of directory names which will always be
          present.
        * fileBase - the part of the fileName before the last
          period. If no '/' is present after the host (or port), the
          fileBase value will be None, otherwise it will be a
          (possibly empty) string.
        * fileExt - the part of the fileName after the last period. If
          fileBase is None it will also be None and if no period
          exists in the fileName it will be None.

        """
        # check for a cached version
        if self.__split is not None:
            return self.__split.copy()

        # else split it and cache it
        d = self.__super.split(self)
        # TODO: later also split ;type?param#andFragments
        d.update(UrlPathUtils.splitHeirarchicalUrlPath(d['urlPath']))
        self.__split = d
        return d
示例#4
0
    def split(self):
        """
        Splits the path into:

        * protocol - should always be 'http'
        * user - optional user. This will only be populated if the
          user is actually included in the path. That is, if an
          Authentication object has been set it will not be used to
          populate this field.
        * password - only present if a user was given and even then
          it's optional.
        * host - either an ip address or a host name. Must be present
          for a valid HTTP url.
        * port - optional port number.
        * urlPath - everything after the '/' after the host and
          optional port or None.
        * dirs - a list of directory names which will always be
          present.
        * fileBase - the part of the fileName before the last
          period. If no '/' is present after the host (or port), the
          fileBase value will be None, otherwise it will be a
          (possibly empty) string.
        * fileExt - the part of the fileName after the last period. If
          fileBase is None it will also be None and if no period
          exists in the fileName it will be None.

        """
        # check for a cached version
        if self.__split is not None:
            return self.__split.copy()

        # else split it and cache it
        d=self.__super.split(self)
        # TODO: later also split ;type?param#andFragments
        d.update(UrlPathUtils.splitHeirarchicalUrlPath(d['urlPath']))
        self.__split=d
        return d