From: Hong Y. <hon...@ho...> - 2005-01-06 19:06:40
|
Is it possible to get the insert ID of the an object before the item is actually created in the database, in the __init__ method or _set_* methods for instance? I would like to copy a file with the database object ID as part of the name, and only when the copy is successful do I want the database entry with that ID to be created. I plan to do the copy in the __init__ method, and only if that is OK will the SQLObject.__init__ be called. But I can't get the ID of the to-be-inserted object. Of course I can first create the database entry and do the file copy afterwards in _init, and delete the item if the copy is not successful, but that seems to be less elegant, and I am not sure if it is safe to delete the item in the _init method. Best Regards Hong Yuan |