Greetings,

I just started using py4web, and I'm very excited to do so. 

Has there been any more thought on this issue? I was partially into a new 
web2py app in which I use _enable_record_versioning(), and I am migrating 
it to py4web.

Thanks.


On Saturday, August 17, 2019 at 10:34:21 PM UTC-7, Massimo Di Pierro wrote:
>
> Sorry for the late response. I just run into this myself. Do not have a 
> good solution at this time, unless we make pydal aware of 
> ThreadSafeVariable(s). Maybe we have to.
>
> On Wednesday, 31 July 2019 05:05:50 UTC-7, Manuel Vio wrote:
>>
>> 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/83623a73-8a71-4523-8cbb-79ec3cea70f9%40googlegroups.com.

Reply via email to