No obvious solution yet but will prioritize this. Would you mind opening an 
issue on github about this?

On Wednesday, 19 February 2020 12:33:32 UTC-8, Carlos Hanson wrote:
>
> It looks like table inheritance is affected by the same issue:
>
>
> monster = db.Table(db, 'monster', Field('color'), Field('size'))
> db.define_table('thing', Field('name'), monster)
>
>
> The following traceback is the same as the error using 
> _enable_record_versioning() starting at *table = self.lazy_define_table*:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/chanson/py/py4web/apps/thing/__init__.py", line 7, in 
> <module>
>     from . models import db
>   File "/home/chanson/py/py4web/apps/thing/models.py", line 9, in <module>
>     db.define_table('thing', Field('name'), monster)
> *  File 
> "/home/chanson/.local/share/virtualenvs/py4web-recc_4-8/lib/python3.6/site-packages/pydal/base.py",
>  
> line 656, in define_table*
> *    table = self.lazy_define_table(tablename, *fields, **kwargs)*
> *  File 
> "/home/chanson/.local/share/virtualenvs/py4web-recc_4-8/lib/python3.6/site-packages/pydal/base.py",
>  
> line 676, in lazy_define_table*
> *    if field.requires is DEFAULT:*
> *  File 
> "/home/chanson/.local/share/virtualenvs/py4web-recc_4-8/lib/python3.6/site-packages/threadsafevariable/__init__.py",
>  
> line 16, in __get__*
> *    return getattr(self.storage, "%s.%s" % (id(instance), id(self)))*
> *  File "src/gevent/local.py", line 408, in 
> gevent._local.local.__getattribute__*
> AttributeError: 'gevent._local.local' object has no attribute 
> '139976984026752.139976984930736'
>
>
>
> On Tuesday, February 18, 2020 at 8:07:25 PM UTC-8, Carlos Hanson wrote:
>>
>> 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/0e39aaa8-753d-41b9-965e-a04c19ec14ac%40googlegroups.com.

Reply via email to