On Monday 07 April 2008 03:20:31 am Ed Leafe wrote:
> On Apr 6, 2008, at 11:20 PM, johnf wrote:
> > prodcostDescript is a virtualfield.
> > self.VirtualFields={'prodcostDescript':self.costtype}
>
> Are you setting the property like that, or are you passing it as a
> keyword argument in the bizobj's constructor?
>
> > def costtype(self):
> > try:
> > if self.Form.agprodcotypeBizobj.getFieldVal('ntrackby') == 0:
> > #weight
> > return('Kg')
> > else:
> > return('Seed Cnt')
> > except:
> > return('')
> >
> >
> > Dabo Error Log: Sun Apr 6 21:13:30 2008: Field 'prodcostDescript'
> > does not
> > exist in the DataStructure
> > Traceback (most recent call last):
> > File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/
> > _core.py",
> > line 14345, in <lambda>
> > lambda event: event.callable(*event.args, **event.kw) )
> > File "/home/johnf/downloads/dabo/dabo/ui/uiwx/dPemMixin.py", line
> > 436, in
> > _bindDelayed
> > mthd = eval(mthdString)
> > File "<string>", line 0
> >
> > ^
> > SyntaxError: unexpected EOF while parsing
>
> This is very odd: the _bindDelayed() method should only ever be
> called for any keyword event bindings; i.e., keyword args such as
> OnHit=somemethod or OnGotFocus=someothermethod. The code only looks
> for kwargs that start with 'On', so I don't understand how
> 'VirtualFields' would have ever made it into that list. Please show me
> the code that creates the bizobj in question.
>
> -- Ed Leafe
class PublicagprodcostBizobj(dabo.biz.dBizobj):
def afterInit(self):
self.DataSource = "public.agprodcost"
self.VirtualFields={'prodcostDescript':self.costtype}
self.KeyField = "pkid"
self.addFrom("public.agprodcost")
self.addField("cowner")
self.addField("pkid")
self.addField("include")
self.addField("fk_agprodcotype")
self.addField("fk_apvend")
self.addField("ccosttype")
self.addField("fk_agproduction")
self.addField("ncost")
self.addField("payee")
self.ParentLinkField ="pkid"
self.LinkField ="fk_agproduction"
self.FillLinkFromParent = True
def costtype(self):
try:
if self.Form.agprodcotypeBizobj.getFieldVal('ntrackby')
== 0: #weight
return('Kg')
else:
return('Seed Cnt')
except:
return('')
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
ret = ""
# Add your business rules here.
return ret
--
John Fabiani
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]