On Wednesday, October 26, 2016 at 4:07:45 AM UTC-4, Ramos wrote:
>
> but there were no record to update. it should have created a record.
> as i said i created a rruid field in an existing table and the first time
> i run the update_or_insert the rruid field of all the records were empty.
>
Here's the code for update_or_insert:
def update_or_insert(self, _key=DEFAULT, **values):
if _key is DEFAULT:
record = self(**values)
elif isinstance(_key, dict):
record = self(**_key)
else:
record = self(_key)
if record:
record.update_record(**values)
newid = None
else:
newid = self.insert(**values)
return newid
It's hard to say what's going wrong in your case without knowing more about
the rest of the code and data. Perhaps request.vars.ruuid is None and
therefore matching all the records.
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 [email protected].
For more options, visit https://groups.google.com/d/optout.