made shure that tools works with lazy tables (but auth_* fields not lazy)

This commit is contained in:
mdipierro
2012-08-17 22:45:56 -05:00
parent 872a311320
commit c48c06e83d
3 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-08-17 21:29:32) dev
Version 2.00.0 (2012-08-17 22:45:52) dev
+3 -3
View File
@@ -7319,13 +7319,13 @@ class Table(dict):
return # do not try define the archive if already exists
fieldnames = self.fields()
field_type = self if archive_db is self._db else 'bigint'
archive_table = archive_db.define_table(
archive_db.define_table(
archive_name,
Field(current_record,field_type),
*[field.clone(unique=False) for field in self])
self._before_update.append(
lambda qset,fs,at=archive_table,cn=current_record:
archive_record(qset,fs,at,cn))
lambda qset,fs,db=archive_db,an=archive_name,cn=current_record:
archive_record(qset,fs,db[an],cn))
if is_active and is_active in fieldnames:
self._before_delete.append(
lambda qset: qset.update(is_active=False))
+6 -5
View File
@@ -1383,11 +1383,12 @@ class Auth(object):
signature_list = [signature]
else:
signature_list = signature
lazy_tables, db._lazy_tables = db._lazy_tables, False
if not settings.table_user_name in db.tables:
passfield = settings.password_field
extra_fields = settings.extra_fields.get(
settings.table_user_name,[])+signature_list
if username or settings.cas_provider:
if username or settings.cas_provider:
table = db.define_table(
settings.table_user_name,
Field('first_name', length=128, default='',
@@ -1570,6 +1571,7 @@ class Auth(object):
settings.table_user_name,
settings.table_user._format)
settings.table_cas = db[settings.table_cas_name]
db._lazy_tables = lazy_tables
if settings.cas_provider:
settings.actions_disabled = \
['profile','register','change_password','request_reset_password']
@@ -3118,13 +3120,12 @@ class Auth(object):
table = form.table
if not archive_table:
archive_table_name = '%s_archive' % table
if archive_table_name in table._db:
archive_table = table._db[archive_table_name]
else:
archive_table = table._db.define_table(
if not archive_table_name in table._db:
table._db.define_table(
archive_table_name,
Field(current_record,table),
*[field.clone(unique=False) for field in table])
archive_table = table._db[archive_table_name]
new_record = {current_record:form.vars.id}
for fieldname in archive_table.fields:
if not fieldname in ['id',current_record]: