On 8/17/10 5:50 PM, Jim Byrnes wrote:
> Paul McNett wrote:
>> On 8/17/10 9:53 AM, Jim Byrnes wrote:
>>> John Fabiani wrote:
>>>> On Tuesday, August 17, 2010 08:45:14 am Jim Byrnes wrote:
>>>>>> Most of the time the "NoneType" is saying the the object does not
>>>>>> exist.  I think it applies to your error message.
>>>>>
>>>>> OK, is there anyway to determine what object it is looking for?
>>>>>
>>>>>> If you are using the ClassDesigner I would do the following to play and
>>>>>> learn a little more.
>>>>>>
>>>>>> I would add the dropdown to the form.  Fillin the choices
>>>>>> properties.  Run the form.  Use the dShell (control-d to open) and try
>>>>>> accessing the value. by typing the following (the same is true with my
>>>>>> form:
>>>>>>
>>>>>> self.RegID.Value  #change the RegID to match what you used in RegID
>>>>>
>>>>> If I do this from dShell Value is correct and no error message is
>>>>> displayed.  If I run my program Value is correct but the error message
>>>>> appears.
>>>>>
>>>>> The maddening thing about this is I based my code on the Pycon tutorial
>>>>> I completed and which runs fine.  I have opened the corresponding files
>>>>> side by side in my editor and still can't see where I went wrong.
>>>>>
>>>>> Thanks for your efforts,
>>>>
>>>> This is a SWAG but if it works in dShell then maybe you just have the 
>>>> relative
>>>> access wrong in the code.  Try things like "self.RegID.Value",
>>>> "self.Form.RegID.Value", or even "self.parent.RegID.Value" in the code.
>>>> Normally, you find the correct relation by using dShell.  So tell me what 
>>>> you
>>>> typed in dShell to find the value.
>>>
>>> In the dShell if I type self.PwordsCategories.Value I get what was
>>> selected in the dDropdownList and no Dabo error. The thing is when I run
>>> my code I don't even have to get the Value, simply opening the
>>> dDropddownList and selecting any item will trigger the error:
>>>
>>> Dabo Error Log: Tue Aug 17 11:39:35 2010: Could not bind to
>>> 'categories.Category'
>>> Reason: 'NoneType' object has no attribute 'Category'
>>
>> Sounds like you never called form.addBizobj("categories")
>
> Is  " form.addBizobj " necessary? I called it like this in as shown in
> pwords-code.py:
>
> ## *!* ## Dabo Code ID: dForm-top
> def afterInit(self):
>       self.requery()
>
> def createBizobjs(self):
>       pwdsBizobj = self.Application.biz.PwdsBizobj(self.Connection)
>       self.addBizobj(pwdsBizobj)
>       #print 'TEST'
>

You call addBizobj() of the form, so you are good there. However, what's the 
DataSource of pwdsBizobj? The control thinks it is "categories".


>> In any case, the DataSource you assigned to the control ("categories") 
>> doesn't match
>> up with the DataSources of any of the bizobjs assigned to the form.
>>
>> Paul
>
> So that's what the error message means, it thinks that categories is a
> control.  That was not my intent and I can't figure out what i did wrong
> to make it treat categories as a control.

No, the error message doesn't mean that it thinks categories is a control. It 
thinks 
"categories" is the name of the bizobj to bind to (because the DataSource of 
one of 
the UI controls is set to "categories".

> The db is named "Passwords"
> The table in the de is named "pwds"
> The dDropdownList's RegID is "PwordsCategories"
> It's Datasource = "categories"
> It's Datafield = "Category"

What about the bizobj associated with the pwds table? What is *it's* DataSource 
set to?

> Trying to  figure out why it thinks categories is a control I loaded all
> the files involved in this project into my text editor and did a search
> of all buffers for "categories". It was found in 5 lines in 2 files.
>
> PwdsBizobj.py:
>
> def getCategories(self):
>               crs = self.getTempCursor()
>               crs.execute("""select distinct Category from pwds""")
>               ds = crs.getDataSet()
>               categories = [rec["Category"] for rec in ds]
>               return categories
>
> pwords-code.py
>
> ## *!* ## Dabo Code ID: dDropdownList-dPanel
>
> def afterInit(self):
>       pwordsBiz = self.Form.getBizobj('pwds')
>       categories = pwordsBiz.getCategories()
>       categories.insert(0, '<None>')
>       self.Choices = categories
>
> Hopefully this is enough info for you to show me where I went wrong,
> because I know once I get it figured out I am going to enjoy working
> with Dabo.

Oh, okay. Your dropdown lists categories, gotten by calling 
PwdsBizobj.getCategories(). So you need to change the dropdown's DataSource 
from 
"categories" to "pwds", because that is the source of the data that determines 
the 
current Value of the dropdown (which category is selected).

Paul
_______________________________________________
Post Messages to: [email protected]
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/[email protected]

Reply via email to