fixed some bugs with singleton and remobed password from session.auth.user

This commit is contained in:
mdipierro
2012-09-30 07:26:23 -05:00
parent 5f727f6e6e
commit 2348709622
4 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.0.9 (2012-09-30 00:23:07) dev
Version 2.0.9 (2012-09-30 07:26:14) dev
+4 -4
View File
@@ -6577,16 +6577,15 @@ class DAL(object):
if 'singleton_code' in kwargs:
singleton_code = kwargs['singleton_code']
del kwargs['singleton_code']
else:
singleton_code = hashlib.md5(uri).hexdigest()
singleton_code = hashlib.md5(uri).hexdigest()
try:
db = thread_local.db_instances[singleton_code]
if args or kwargs:
raise RuntimeError, 'Cannot duplicate a Singleton'
except KeyError:
db = super(DAL, cls).__new__(cls, uri, *args, **kwargs)
db._singleton_code = singleton_code
thread_local.db_instances[singleton_code] = db
db._singleton_code = singleton_code
return db
@staticmethod
@@ -6641,7 +6640,8 @@ class DAL(object):
migrate_enabled=True, fake_migrate_all=False,
decode_credentials=False, driver_args=None,
adapter_args=None, attempts=5, auto_import=False,
bigint_id=False,debug=False,lazy_tables=False):
bigint_id=False,debug=False,lazy_tables=False,
singleton_code=None):
"""
Creates a new Database Abstraction Layer instance.
+4 -4
View File
@@ -419,11 +419,11 @@ class Response(Storage):
BUTTON = TAG.button
admin = URL("admin","default","design",
args=current.request.application)
from gluon.dal import thread
if hasattr(thread,'instances'):
from gluon.dal import thread_local
if hasattr(thread_local,'instances'):
dbstats = [TABLE(*[TR(PRE(row[0]),'%.2fms' % (row[1]*1000)) \
for row in i.db._timings]) \
for i in thread.instances]
for i in thread_local.instances]
dbtables = dict([(regex_nopasswd.sub('******',i.uri),
{'defined':
sorted(list(set(i.db.tables) -
@@ -431,7 +431,7 @@ class Response(Storage):
'[no defined tables]',
'lazy': sorted(i.db._LAZY_TABLES.keys()) or
'[no lazy tables]'})
for i in thread.instances])
for i in thread_local.instances])
else:
dbstats = [] # if no db or on GAE
dbtables = {}
+1
View File
@@ -1710,6 +1710,7 @@ class Auth(object):
login the user = db.auth_user(id)
"""
user = Storage(self.table_user()._filter_fields(user,id=True))
if 'password' in user: del user.password
current.session.auth = Storage(
user = user,
last_visit = current.request.now,