INSERT and .refresh() problems
Faber <[email protected]> Mon, 27 Jun 2005 03:20:02 +0200
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Organization | FaberBox |
| Message-ID | <[email protected]> |
Hello,
I'm using the last beta version of PyDO2. I need to insert a tuple in a
relation, then use it's ID autoincrement field value as foreign key value
for another new tuple (in another relation).
a = Relation.new(field1 = "value")
a.refresh() # To get the Relation.id value
b = OtherRelation.new(field1 = "value", foreignkey = a.id)
OtherRelation.commit() # Commits both changes
(of course there are some try/except statements where needed...)
In previous version of PyDO2 that would work, but in the latest I receive
following exception on a.refresh() call:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "pydo/base.py", line 626, in refresh
raise ValueError, "current object doesn't exist in database!"
ValueError: current object doesn't exist in database!
Should I do a Relation.commit() before the a.refresh() call or it's a bug
and I can continue to use this code, waiting for the fix? ;)
Regards
--
Faber
http://www.faberbox.com/
There are not many persons who know what wonders are opened to them in the
stories and visions of their youth; for when as children we learn and
dream, we think but half-formed thoughts, and when as men we try to
remember, we are dulled and prosaic with the poison of life. -- H.P.
Lovecraft
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click