diff options
Diffstat (limited to 'cgi/framework.py')
-rw-r--r-- | cgi/framework.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cgi/framework.py b/cgi/framework.py index 4c89bb7..e827f67 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -56,6 +56,15 @@ def setBoard(dir): return board +def cleanDir(path, ext=None): + if ext: + filelist = [ f for f in os.listdir(path) if f.endswith("." + ext) ] + else: + filelist = os.listdir(path) + + for f in filelist: + os.remove(os.path.join(path, f)) + def addressIsBanned(ip, board): packed_ip = inet_aton(ip) bans = FetchAll("SELECT * FROM `bans` WHERE (`netmask` IS NULL AND `ip` = '"+str(packed_ip)+"') OR (`netmask` IS NOT NULL AND '"+str(packed_ip)+"' & `netmask` = `ip`)") |