##// END OF EJS Templates
paths: make getpath() accept multiple defaults...
Yuya Nishihara -
r27561:723413ee default
parent child Browse files
Show More
@@ -1115,7 +1115,7 b' class paths(dict):'
1115 self['default'].pushloc = defaultpush
1115 self['default'].pushloc = defaultpush
1116
1116
1117 def getpath(self, name, default=None):
1117 def getpath(self, name, default=None):
1118 """Return a ``path`` from a string, falling back to a default.
1118 """Return a ``path`` from a string, falling back to default.
1119
1119
1120 ``name`` can be a named path or locations. Locations are filesystem
1120 ``name`` can be a named path or locations. Locations are filesystem
1121 paths or URIs.
1121 paths or URIs.
@@ -1125,13 +1125,16 b' class paths(dict):'
1125 """
1125 """
1126 # Only fall back to default if no path was requested.
1126 # Only fall back to default if no path was requested.
1127 if name is None:
1127 if name is None:
1128 if default:
1128 if not default:
1129 default = ()
1130 elif not isinstance(default, (tuple, list)):
1131 default = (default,)
1132 for k in default:
1129 try:
1133 try:
1130 return self[default]
1134 return self[k]
1131 except KeyError:
1135 except KeyError:
1132 return None
1136 continue
1133 else:
1137 return None
1134 return None
1135
1138
1136 # Most likely empty string.
1139 # Most likely empty string.
1137 # This may need to raise in the future.
1140 # This may need to raise in the future.
General Comments 0
You need to be logged in to leave comments. Login now