Fix WOFileUtils

This commit is contained in:
VirtuBox
2019-10-26 01:30:52 +02:00
parent 7765b2ce84
commit f3f0573954
2 changed files with 7 additions and 6 deletions

View File

@@ -173,6 +173,7 @@ Apps & Tools shipped with WordOps :
- [ClamAV](https://github.com/Cisco-Talos/clamav-devel)
- [cheat.sh](https://github.com/chubin/cheat.sh)
- [ProFTPd](https://github.com/proftpd/proftpd)
- [nginx-ultimate-bad-bot-blocker](https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/)
Cache Plugins supported by WordOps :

View File

@@ -280,15 +280,15 @@ class WOFileUtils():
"""
Searches for string in file and returns True or False.
"""
if os.path.isfile(fnm):
if os.path.isfile('{0}'.format(fnm)):
try:
Log.debug(self, "Finding string {0} to file {1}"
.format(sstr, fnm))
for line in open(fnm, encoding='utf-8'):
if sstr in line:
return True
return False
except OSError as e:
for line in open(fnm, encoding='utf-8'):
if sstr in line:
return True
return False
except OSError as e:
Log.debug(self, "{0}".format(e.strerror))
Log.error(self, "Unable to Search string {0} in {1}"
.format(sstr, fnm))