On 10/12/11 9:11 PM, Vineet Deodhar wrote:
> Oops.
> In anxiety, I just ran your code as it is (missed to setup relationships 
> here).
> Sorry.
> I will set it up properly&  post the result.
>--Vineet
>No big deal. I meant to write it, but knew I'd likely get waylayed with other 
>things today so I posted what I already had from a prior test.
>Paul
=============================
 
I tested with the code given by Paul ...
...and I am going MAD over this.
Why?
Because the SAME logic works with this test coe, but not with my actual code.
 
I am 100% sure that no definition is missed in actual code (such as KeyField, 
LinkField, FillLinkFromParent, AddChild())
Let me cool down my brain a bit & recheck the code the fourth time (already 
checked 3 times).
The reason I am not posting the code here is that it is in "web2py" fashion.
That may create confusion to the list members, and waste their precious time 
(which I don't want).
 
Still, if in case of not finding out what's wrong, I will post the code along 
with explanation of web2py code.
 
++++Test Code++++
import dabo
con = dabo.db.connect(":memory:")
cur = con.cursor()
#create tables
cur.execute("create table parenT (pid integer PRIMARY KEY AUTOINCREMENT NOT 
NULL, pfirstname char)")
cur.execute("create table chilD (cid integer PRIMARY KEY AUTOINCREMENT NOT 
NULL, pid integer, cfirstname char, FOREIGN KEY(pid) REFERENCES parenT(pid))")
cur.execute("create table grandchilD (gid integer PRIMARY KEY AUTOINCREMENT NOT 
NULL, cid integer, gfirstname char, FOREIGN KEY(cid) REFERENCES chilD(cid))")
#populate parenT table
cur.execute("insert into parenT (pid, pfirstname) values (1, 'Paul')")
cur.execute("insert into parenT (pid, pfirstname) values (2, 'Ed')")
#classes for bizobj
class pBiz(dabo.biz.dBizobj):
  def initProperties(self):
    self.DataSource = "parenT"
    self.KeyField = "pid"
class cBiz(dabo.biz.dBizobj):
  def initProperties(self):
    self.DataSource = "chilD"
    self.KeyField = "cid"
    self.FillLinkFromParent = True
class gBiz(dabo.biz.dBizobj):
  def initProperties(self):
    self.DataSource = "grandchilD"
    self.KeyField = "gid"
    self.FillLinkFromParent = True
#instantiate bizobjs
PBiz = pBiz(con)
CBiz = cBiz(con)
GBiz = gBiz(con)
#setup relationships
PBiz.addChild(CBiz)
CBiz.LinkField = 'pid'
CBiz.addChild(GBiz)
GBiz.LinkField = 'cid'
#start processing
PBiz.requery()
print "testing PBiz:", PBiz.getDataSet()
CBiz.new()
CBiz.setFieldVals({'cid':1, 'pid':1, 'cfirstname':'paul_child'})
GBiz.new()
GBiz.setFieldVals({'gid':1, 'cid':1, 'gfirstname':'paul_grandchild'})
PBiz.saveAll()
PBiz.requery()
print "Testing parenT:", PBiz.getDataSet()
print "Testing chilD:", CBiz.getDataSet()
print "Testing grandchilD:", GBiz.getDataSet()
++++End Test Code++++

--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: Dabo-users@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/1318514369.51497.yahoomail...@web160502.mail.bf1.yahoo.com

Reply via email to