[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread xelomac
Sorry - I cannot comprehend what I have done wrong before. 
"if db[table][column].writable == False:" works now as expected.

On Sunday, April 8, 2018 at 5:44:55 PM UTC+2, Anthony wrote:
>
> On Sunday, April 8, 2018 at 4:27:59 AM UTC-4, xelomac wrote:
>>
>> Hi all,
>>
>> in a controller function I want to check if a field is set as writable in 
>> the model before updating it. "if db[table][column].writable == False" did 
>> not work.
>>
>
> What do you mean by "did not work"? That is the correct way to check the 
> writable attribute. We need more info.
>
> Anthony
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread Anthony
On Sunday, April 8, 2018 at 4:27:59 AM UTC-4, xelomac wrote:
>
> Hi all,
>
> in a controller function I want to check if a field is set as writable in 
> the model before updating it. "if db[table][column].writable == False" did 
> not work.
>

What do you mean by "did not work"? That is the correct way to check the 
writable attribute. We need more info.

Anthony

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Using variables in db.table.field expressions

2018-04-08 Thread 黄祥
perhaps you can print the value of fields writable then compare it
*e.g.*
field_writable = db.table.field.writable

*ref:*
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Run-time-field-and-table-modification

best regards,
stifan

-- 
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.
For more options, visit https://groups.google.com/d/optout.