Splits a URL up into a list object. Parses a specified URL and breaks it into a list. Args: path (str): The path to split up into a list. unquote (:obj:`bool`, optional): call unquote on each element added to the returned list. Retu
(path, unquote=True)
| 710 | |
| 711 | @staticmethod |
| 712 | def split_path(path, unquote=True): |
| 713 | """Splits a URL up into a list object. |
| 714 | |
| 715 | Parses a specified URL and breaks it into a list. |
| 716 | |
| 717 | Args: |
| 718 | path (str): The path to split up into a list. |
| 719 | unquote (:obj:`bool`, optional): call unquote on each element |
| 720 | added to the returned list. |
| 721 | |
| 722 | Returns: |
| 723 | list: A list containing all of the elements in the path |
| 724 | """ |
| 725 | |
| 726 | try: |
| 727 | paths = PATHSPLIT_LIST_DELIM.split(path.lstrip("/")) |
| 728 | if unquote: |
| 729 | paths = [URLBase.unquote(x) for x in filter(bool, paths)] |
| 730 | |
| 731 | except AttributeError: |
| 732 | # path is not useable, we still want to gracefully return an |
| 733 | # empty list |
| 734 | paths = [] |
| 735 | |
| 736 | return paths |
| 737 | |
| 738 | @staticmethod |
| 739 | def parse_list(content, allow_whitespace=True, unquote=True): |