fixws and 'new' button in grid query

This commit is contained in:
Massimo Di Pierro
2011-12-05 11:39:42 -06:00
parent 01f6f82cdf
commit d281acb421
305 changed files with 8352 additions and 8032 deletions
+7 -5
View File
@@ -77,9 +77,9 @@ def read_hosts_deny():
int(fields[2].strip()) # last attempts
)
portalocker.unlock(f)
f.close()
f.close()
return hosts
def write_hosts_deny(denied_hosts):
f = open(deny_file, 'w')
portalocker.lock(f, portalocker.LOCK_EX)
@@ -88,7 +88,7 @@ def write_hosts_deny(denied_hosts):
line = '%s %s %s\n' % (key, val[0], val[1])
f.write(line)
portalocker.unlock(f)
f.close()
f.close()
def login_record(success=True):
denied_hosts = read_hosts_deny()
@@ -101,11 +101,11 @@ def login_record(success=True):
and val[0] >= allowed_number_of_attempts:
return val[0] # locked out
time.sleep(2**val[0])
val = (val[0]+1,int(time.time()))
val = (val[0]+1,int(time.time()))
denied_hosts[request.client] = val
write_hosts_deny(denied_hosts)
return val[0]
# ###########################################################
# ## session expiration
@@ -144,3 +144,5 @@ if request.controller=='appadmin' and DEMO_MODE:
session.flash = 'Appadmin disabled in demo mode'
redirect(URL('default','sites'))