I can't, there's no record instance... So it's .update for me.

On May 11, 12:53 am, Thadeus Burgess <[email protected]> wrote:
> Use ``update_record`` instead of ``update``.
>
> the ``update`` function comes from the dict parent class, and does not issue
> SQL.
>
> ``update_record`` is a web2py thing that will take any changes made to the
> record instance (by use of assignment or update function) and issue the
> appropriate SQL
>
> --
> Thadeus
>
>
>
>
>
>
>
> On Mon, May 9, 2011 at 9:37 PM, niknok <[email protected]> wrote:
> > Yes, guys thanks. I realized that that was the culprit this morning.
> > Hard to decode with beer fogging your thoughts... :P
>
> > Reverted to the original and all is working again. I forgot I was
> > testing that line from a code in the book.
>
> > On May 9, 11:01 pm, Anthony <[email protected]> wrote:
> > > On Monday, May 9, 2011 10:45:36 AM UTC-4, niknok wrote:
>
> > > > I have these lines that is supposed to update a record but it doesn't:
>
> > > >     db.card.validated.writable=True
> > > >     db.card.modified_by.writable=True
>
> > db.card(db.card.alnum==c_hash).update(validated=True,modified_by=auth.user.
> > id)
>
> > > > Is there anything I missed? I tried to include a manual db.commit(),
> > but
> > > > that didn't work either.
>
> > > You can use the db.card(db.card.alnum==c_hash) notation to fetch a row
> > > (though I think you have to include the record ID as the first argument),
> > > but I'm not sure you can use it to update a record. For that, you may
> > have
> > > to use the usual query notation: db(db.card.alum==c_hash).update(...).
> > You
> > > might also be able to use your original notation along with
> > update_record,
> > > but I don't see any reason to prefer that over the usual method.
>
> > > Anthony

Reply via email to