Niphlod,

Would a lambda work there?

something like db.person1.name = lambda db.person1.name: 
db.person1.name.capitalize()

On Saturday, November 10, 2012 1:02:42 PM UTC-5, mweissen wrote:
>
> I have tried this example 
>
> def visit():
>     db(db.person1.id>0).update(
>         visits = db.person1.visits + 1,
>        )
>     
> It is in the book and works fine.
> Now I have added another line...
>
> def visit():
>     db(db.person1.id>0).update(
>         visits = db.person1.visits + 1,
>         name = db.person1.name.capitalize(),
>         )
>
> .. and I got an error:    
> <type 'exceptions.AttributeError'> 'Field' object has no attribute 
> 'capitalize'(1) I do not understand why it is possible to add 1 to a 
> field, but not to do something other with a string.
>
> (2) Is there any simple solution? Of course I could write something like
>
> for r in db(db.person1.id>0).select():
>    ... update ...
>
> Regards, Martin
>
>

-- 



Reply via email to