Changeset 1466 for trunk/peppy/vfs/itools/uri/generic.py
- Timestamp:
- 07/07/08 12:32:30 (5 months ago)
- Files:
-
- 1 modified
-
trunk/peppy/vfs/itools/uri/generic.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/peppy/vfs/itools/uri/generic.py
r1462 r1466 738 738 scheme, authority, path, query, fragment = urlsplit(data) 739 739 740 # Convenience function to break out the fragment from a file URL. This 741 # assumes that the only allowed fragments are digits, specifying line 742 # numbers. 743 def find_fragment(path, fragment): 744 if "#" in path: 745 # the fragment is improperly placed in the path 746 path1, fragment1 = path.rsplit("#", 1) 747 if fragment1.isdigit(): 748 return path1, fragment1 749 return path, fragment 750 740 751 # Some special cases for Windows paths c:/a/b#4 and file:///c:/a/b#4. 741 752 # urlsplit has problems with the scheme, leading slashes in the path, … … 744 755 # found a windows drive name instead of path, because urlsplit 745 756 # thinks the scheme is "c" for Windows paths like "c:/a/b" 746 if "#" in path: 747 # the fragment is improperly placed in the path 748 path, fragment = path.rsplit("#", 1) 757 path, fragment = find_fragment(path, fragment) 749 758 path = "%s:%s" % (scheme, path) 750 759 scheme = "file" … … 755 764 drive = path[1].lower() 756 765 path = path[3:] 757 if "#" in path: 758 path, fragment = path.rsplit("#", 1) 766 path, fragment = find_fragment(path, fragment) 759 767 path = "%s:%s" % (drive, path) 760 768
