thanks a lot ! 2012/7/12 Scott Gelin <[email protected]>
> I should mention the documentation lists it as a keyword argument, so I > guess it is implied to include 'var='. The syntax example is for select, > where it works as it is shown and with vars= > > db.update requires the parameter be expressed as a kwarg . > > On Thu, Jul 12, 2012 at 9:26 AM, Scott Gelin <[email protected]>wrote: > >> I'll take a crack - I stumbled on this initially as well, you can >> accomplish it via two ways: >> >> id = api.me().id >> db.update('Authenticated_user', >> where='id_user=$id', >> last_update=tl[0].id, >> vars=locals()) >> >> or prepend vars= to your dict declaration: >> >> db.update("Authenticated_user", >> vars={"id": api.me().id}, >> where="id_user=$id", >> last_update=tl[0].id) >> >> For some reason the documentation omits including it, but you need it. >> >> Heres an inline example: >> >>> tl=[] >> >>> tl.append(dict(id='some_other_thing')); >> >>> db.update("Authenticated_user", vars={"id": >> "some_id"},where='id_user=$id',last_update=tl[0]['id'], _test=True) >> >> <sql: "UPDATE Authenticated_user SET last_update = 'some_other_thing' >> WHERE id_user='some_id'"> >> >> >> >> On Thu, Jul 12, 2012 at 4:01 AM, Alex Patchanka <[email protected]>wrote: >> >>> Hallo there! I am new to this list, this is my first e-mail. >>> I am trying to do an update to the database. >>> >>> this doesn't work: >>> >>> db.update("Authenticated_user", {"id": api.me().id}, >>> where="id_user=$id", last_update=tl[0].id) >>> >>> >>> while this works, but looks uglier: >>> >>> db.update("Authenticated_user", where="id_user="+str(api.me().id), >>> last_update=tl[0].id) >>> >>> >>> Does anyone know why? The documentation of update is here >>> http://webpy.org/cookbook/select and I think I am doing it right >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "web.py" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/webpy?hl=en. >>> >> >> > -- > You received this message because you are subscribed to the Google Groups > "web.py" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/webpy?hl=en. > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
