Fix file.contains: search for the string rather than requiring an exact match

This commit is contained in:
Dan Sheridan 2013-01-03 11:12:50 +00:00
parent 72b8322395
commit e26322f567

View File

@ -637,10 +637,11 @@ def contains(path, text):
if not os.path.exists(path):
return False
stripped_text = test.strip()
try:
with BufferedReader(path) as breader:
for chunk in breader:
if text.strip() == chunk.strip():
if stripped_text in chunk:
return True
return False
except (IOError, OSError):