I believe I have a solution in the last commit:
44904e47f5b5eec89b06ec332bd3094ec76ec3dd
If should allow to do
db.mytable.myfield.readable = True
@action('index')
@action.uses(db)
def index():
db.mytable.myfield.readable = False
and makes db.mytable.myfield.readable thread safe while, every http
request, sees the default values defined at the top level.
I have tested the module I created to achieve this but I have not tested
its application to the Field class.
Also this is not necessarily final since it is a first version of the
threadsafevariable library.
If you can think of more ways to test it, it would be appreciated.
Massimo
On Wednesday, 19 June 2019 07:55:55 UTC-7, Marcelo Huerta wrote:
>
> El viernes, 14 de junio de 2019, 11:32:58 (UTC-3), Massimo Di Pierro
> escribió:
>>
>> Be careful that you can no longer change attributes everywhere you like
>> as in:
>>
>> db.tablename.fieldname.readable = False
>>
>> In web2py this is ok. In web3py this is not safe. Attributes must be
>> global. The state of fixtures must not be modified inside actions.
>>
>>
>>
> And what's the corresponding replacement if you want to change the status
> of "visible" or "readable" only during an action?
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/8214b5e1-3898-4854-9f64-a17e08f04b68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.