Might be easier with a _before_insert callback, so you can add the new 
value along with the initial insert instead of after:

db.mytable._before_insert.append(lambda fields: fields.update(url=make_url(
fields)))

Anthony

On Tuesday, March 10, 2015 at 12:10:12 PM UTC-4, Niphlod wrote:
>
> code an _after_insert callback.
>
> On Tuesday, March 10, 2015 at 4:21:26 PM UTC+1, Louis Amon wrote:
>>
>> I'm trying to hard-code URLs for SEO purposes so I have a function 
>> ("make_url(row)") that builds the paths based on other fields.
>>
>> I was thinking of using "compute=make_url", but it seems that update 
>> operations also call the compute.
>>
>>
>> Is there a way to use compute only on INSERT operations, and not on 
>> UPDATE ?
>>
>

-- 
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.

Reply via email to