Ok, I narrowed the problem a bit:

In py4web/core.py, around line 207, there is this adjustment in order to 
make some variables threadsafe:

# make sure some variables in pydal are thread safe
for _ in ['readable', 'writable', 'default', 'update', 'requires']:
setattr(pydal.DAL.Field, _, threadsafevariable.ThreadSafeVariable())

Turns out that PyDAL's _enable_record_versioning(), in order to create the 
archive table, clones all original fields with their properties. Or, at 
least, it tries to: it seems that copy() fails to correctly transfer 
threadsafevariable informations when dealing with those variables.
I guess that when cloned field's requires attribute is accessed those 
information are not valid anymore and py4web throws the aforementioned 
exception.
I was able to circumvent this error adding an explicit copy of the 
attribute in pydal, but still I'm not sure if this could eventually lead to 
thread problems:

for field in self:
nfk = same_db or not field.type.startswith('reference')
clone = field.clone(unique=False, type=field.type if nfk else 'bigint')
clone.requires = copy.copy(field.requires)
clones.append(
clone
)


Any thougths?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a6c8ae24-b033-4bcd-bd85-210f30df13ff%40googlegroups.com.

Reply via email to