cgilsxml.py: bug
This commit is contained in:
parent
e44003526f
commit
ee2e411856
|
@ -182,6 +182,7 @@ class File:
|
||||||
def find_files(basedir, filters, spec_method='all'):
|
def find_files(basedir, filters, spec_method='all'):
|
||||||
basedir = path.abspath(basedir)
|
basedir = path.abspath(basedir)
|
||||||
files = []
|
files = []
|
||||||
|
|
||||||
deep_filters = [filter for filter in filters if filter.re_spec is not None and filter.deep_scan]
|
deep_filters = [filter for filter in filters if filter.re_spec is not None and filter.deep_scan]
|
||||||
if deep_filters:
|
if deep_filters:
|
||||||
for dirpath, dirnames, filenames in os.walk(basedir):
|
for dirpath, dirnames, filenames in os.walk(basedir):
|
||||||
|
@ -191,7 +192,7 @@ def find_files(basedir, filters, spec_method='all'):
|
||||||
try: file = File(dirpath, filename)
|
try: file = File(dirpath, filename)
|
||||||
except: continue
|
except: continue
|
||||||
matched1 = matched = False
|
matched1 = matched = False
|
||||||
allowed1 = allowed = False
|
allowed = False
|
||||||
for filter in deep_filters:
|
for filter in deep_filters:
|
||||||
if spec_method == 'all' or \
|
if spec_method == 'all' or \
|
||||||
(spec_method == 'first' and not matched):
|
(spec_method == 'first' and not matched):
|
||||||
|
@ -199,16 +200,14 @@ def find_files(basedir, filters, spec_method='all'):
|
||||||
else:
|
else:
|
||||||
matched1 = False
|
matched1 = False
|
||||||
matched = matched1 or matched
|
matched = matched1 or matched
|
||||||
if spec_method == 'all' or \
|
|
||||||
(spec_method == 'first' and matched and not allowed):
|
allowed = filter.match_allow(file) or allowed
|
||||||
allowed1 = filter.match_allow(file)
|
|
||||||
else:
|
|
||||||
allowed1 = False
|
|
||||||
allowed = allowed1 or allowed
|
|
||||||
if matched: pass
|
if matched: pass
|
||||||
elif allowed: file.dontlist = True
|
elif allowed: file.dontlist = True
|
||||||
else: continue
|
else: continue
|
||||||
files.append(file)
|
files.append(file)
|
||||||
|
|
||||||
simple_filters = [filter for filter in filters if filter.re_spec is not None and not filter.deep_scan]
|
simple_filters = [filter for filter in filters if filter.re_spec is not None and not filter.deep_scan]
|
||||||
if simple_filters:
|
if simple_filters:
|
||||||
for name in os.listdir(basedir):
|
for name in os.listdir(basedir):
|
||||||
|
@ -218,7 +217,7 @@ def find_files(basedir, filters, spec_method='all'):
|
||||||
except: continue
|
except: continue
|
||||||
if not file.isfile(): continue
|
if not file.isfile(): continue
|
||||||
matched1 = matched = False
|
matched1 = matched = False
|
||||||
allowed1 = allowed = False
|
allowed = False
|
||||||
for filter in simple_filters:
|
for filter in simple_filters:
|
||||||
if spec_method == 'all' or \
|
if spec_method == 'all' or \
|
||||||
(spec_method == 'first' and not matched):
|
(spec_method == 'first' and not matched):
|
||||||
|
@ -226,16 +225,14 @@ def find_files(basedir, filters, spec_method='all'):
|
||||||
else:
|
else:
|
||||||
matched1 = False
|
matched1 = False
|
||||||
matched = matched1 or matched
|
matched = matched1 or matched
|
||||||
if spec_method == 'all' or \
|
|
||||||
(spec_method == 'first' and matched and not allowed):
|
allowed = filter.match_allow(file) or allowed
|
||||||
allowed1 = filter.match_allow(file)
|
|
||||||
else:
|
|
||||||
allowed1 = False
|
|
||||||
allowed = allowed1 or allowed
|
|
||||||
if matched: pass
|
if matched: pass
|
||||||
elif allowed: file.dontlist = True
|
elif allowed: file.dontlist = True
|
||||||
else: continue
|
else: continue
|
||||||
files.append(file)
|
files.append(file)
|
||||||
|
|
||||||
glob_filters = [filter for filter in filters if filter.glob is not None]
|
glob_filters = [filter for filter in filters if filter.glob is not None]
|
||||||
if glob_filters:
|
if glob_filters:
|
||||||
for filter in glob_filters:
|
for filter in glob_filters:
|
||||||
|
@ -260,6 +257,7 @@ def find_files(basedir, filters, spec_method='all'):
|
||||||
elif filter.match_allow(file): file.dontlist = True
|
elif filter.match_allow(file): file.dontlist = True
|
||||||
else: continue
|
else: continue
|
||||||
files.append(file)
|
files.append(file)
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
||||||
def build_sortfunc(sortby):
|
def build_sortfunc(sortby):
|
||||||
|
|
Loading…
Reference in New Issue