Merge commit 'origin/master' into xrg

Conflicts:
	bin/service/security.py

bzr revid: p_christ@hol.gr-20090813120414-hzfsqq90kr7or65n
This commit is contained in:
P. Christeas 2009-08-13 15:04:14 +03:00
commit 2c638055db
2 changed files with 9 additions and 4 deletions

View File

@ -52,13 +52,14 @@ def check_super(passwd):
raise ExceptionNoTb('AccessDenied')
def check(db, uid, passwd):
if _uid_cache.get(db, {}).get(uid) and _uid_cache.get(db, {}).get(uid) == passwd:
cached_pass = _uid_cache.get(db, {}).get(uid)
if (cached_pass is not None) and cached_pass == passwd:
return True
cr = pooler.get_db(db).cursor()
if passwd:
cr.execute('select count(*) from res_users where id=%s and password=%s', (int(uid), passwd))
cr.execute('select count(1) from res_users where id=%s and password=%s and active=%s', (int(uid), passwd, True))
else:
cr.execute('select count(*) from res_users where id=%s and password is null', (int(uid),))
cr.execute('select count(1) from res_users where id=%s and password is null and active=%s', (int(uid), True))
res = cr.fetchone()[0]
cr.close()
if not bool(res):

View File

@ -125,7 +125,11 @@ def translate(cr, name, source_type, lang, source=None):
class GettextAlias(object):
def __call__(self, source):
frame = inspect.stack()[1][0]
try:
frame = inspect.stack()[1][0]
except:
return source
cr = frame.f_locals.get('cr')
try:
lang = (frame.f_locals.get('context') or {}).get('lang', False)