Skip to content

Commit 37c4b57

Browse files
committed
Use fnmatch to do more robust matching.
1 parent b57129c commit 37c4b57

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

couchdb/tools/replicate.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import time
2424
import urllib
2525
import urlparse
26-
import re
26+
import fnmatch
2727

2828
def findpath(parser, s):
2929
'''returns (server url, path component)'''
@@ -89,13 +89,8 @@ def main():
8989
all = sorted(i for i in source if i[0] != '_') # Skip reserved names.
9090
if not spath:
9191
raise parser.error('source database must be specified')
92-
elif spath in all:
93-
databases = [(spath, tpath if tpath else spath)]
94-
elif '*' in spath:
95-
check = re.compile(spath.replace('*', '.*?'))
96-
databases = [(i, i) for i in all if check.match(i)]
9792
else:
98-
databases = []
93+
databases = [(i, i) for i in all if fnmatch.fnmatchcase(i, spath)]
9994

10095
if not databases:
10196
raise parser.error("no source databases match glob '%s'" % spath)

0 commit comments

Comments
 (0)