prom
prom copied to clipboard
save() when you set the primary key
It's become a common workflow for me to set the primary key, and so I've had to change multiple orm's to do something like this:
from prom.exception import UniqueError
def save(self):
try:
super(Foo, self).save()
except UniqueError:
self.update()
I think .save() should probably just automatically do this, and for the times I want specific error handling I can call .insert() or .update() manually.
https://github.com/Jaymon/prom/issues/119
I think this is handled by Orm.upsert