[TransWarp] Strange EntityDM behavior

John Landahl john at landahl.org
Tue Oct 7 01:23:28 EDT 2003


I'm seeing some strange behavior using EntityDM.  I create a new object, 
assign some values, and commit.  When I try to reload that same object 
(having saved its ID), change a field, and commit, it seems the changes don't 
get saved.  After putting a debug print in my DM's _save method, it appears 
that _save isn't getting called as I would expect.

Attached is a program which isolates and demonstrates the problem.  Even more 
strangely, in this program it seems that _save is never called at all!

TableDM is an attempt to get all the table-related code into one base DM which 
most of my other DMs will subclass.  I don't think the problem is with 
TableDM, though, since it seems to occur with my older DMs which subclass 
EntityDM directly (and which are basically copies of the DMs in the Bulletins 
example).

The output I get for the program (executing via "PYTHONPATH=. peak 
import:test.App") is this:

  === _new
  === _items
  Initial value: "" (should be blank)
  After first update: "update1" (should be "update1")
  After first update: "update2" (should be "update2")
  (1, '', '')

When I'd expect something more like this:

  === _new
  === _items
  Initial value: "" (should be blank)
  === _save
  After first update: "update1" (should be "update1")
  === _load
  === stateFromRow
  === _items
  After first update: "update2" (should be "update2")
  === _save
  (1, 'update3', 'description')

Am I missing something?

John Landahl
john at landahl.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 3740 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20031006/6029f83f/test.py


More information about the PEAK mailing list