Mike Mabey wrote:
> On Fri, Aug 22, 2008 at 1:27 PM, Paul McNett <[EMAIL PROTECTED]> wrote:
> 
>> Mike Mabey wrote:
>>> On Fri, Aug 22, 2008 at 1:10 PM, Paul McNett <[EMAIL PROTECTED]> wrote:
>>>> In the radio list's afterInit(), tell me the return values of:
>>>>
>>>> print [(v, type(v)) for v in self.Choices]
>>>> print self.Value, type(self.Value)
>>>>
>>>> Paul
>>>>
>>> >From start to finish, this is what is printed to the console:
>>>
>>> Dabo Error Log: Fri Aug 22 13:14:40 2008: No radio button matching '1'
>> was
>>> found.
>>> [('1', <type 'str'>), ('2', <type 'str'>), ('3', <type 'str'>), ('4',
>> <type
>>> 'str'>)]
>>> 1 <type 'str'>
>>> Dabo Error Log: Fri Aug 22 13:14:41 2008: No radio button matching '0'
>> was
>>> found.
>>> Dabo Error Log: Fri Aug 22 13:14:41 2008: No radio button matching '0'
>> was
>>> found.
>> Edit dabo/dabo/ui/uiwx/dRadioList.py, and insert lines 493 and 494 as
>> follows:
>>
>>     491         if val is not None:
>>     492           # No such string.
>>     493           print val, type(val)
>>     494           print [(v, type(v)) for v in self.Choices]
>>     495           dabo.errorLog.write(_("No radio button matching '%s'
>> was found.") % val)
> 
> 
> 
> Okay, this is what is printed:
> 
> 1 <type 'int'>
> [('1', <type 'str'>), ('2', <type 'str'>), ('3', <type 'str'>), ('4', <type
> 'str'>)]
> Dabo Error Log: Fri Aug 22 13:39:27 2008: No radio button matching '1' was
> found.

As I suspected, that Value attribute entry in the cdxml is getting 
evaluated as an int instead of a str. You tried removing the Value 
attribute from the cdxml?


> [('1', <type 'str'>), ('2', <type 'str'>), ('3', <type 'str'>), ('4', <type
> 'str'>)]
> 1 <type 'str'>

This was your afterInit() code firing, so we can ignore that for now.

> 0 <type 'long'>
> [('1', <type 'str'>), ('2', <type 'str'>), ('3', <type 'str'>), ('4', <type
> 'str'>)]
> Dabo Error Log: Fri Aug 22 13:39:28 2008: No radio button matching '0' was
> found.

Now the Value has changed to a long int, which probably means it is 
coming from the database/bizobj and this is part of the update() process.

> 0 <type 'long'>
> [('1', <type 'str'>), ('2', <type 'str'>), ('3', <type 'str'>), ('4', <type
> 'str'>)]
> Dabo Error Log: Fri Aug 22 13:39:29 2008: No radio button matching '0' was
> found.

And a second update cycle occurred (happens sometimes still; we'll 
eventually work out how to keep that from happening).


> So, how would it be getting ints and floats as the val?

Not ints and floats, but ints and longs. Int came from the cdxml. Long 
came from the bizobj, from the backend database.

>> The '0' is likely coming from your default value for the field in the
>> bizobj. If '0' is a valid value in the database, the add it as a choice
>> in the Choices. If it is not a valid value, then keep your bizobj from
>> assigning the value of 0 by setting the field's DefaultValue.
> 
> 
> I never added any code to set a default value anywhere.

In that case, Dabo sets the default value for ints and longs to 0.

> I tried adding the
> code that Uwe suggested:
> 
> self.DefaultValues['rlist'] = 1
> 
> in my bizobj code, but it gives me the error 'Compilation Error:No records
> in the data set.' which is weird since I know there are records in the
> table.

I've never seen that error before, so I did a search. It appears that 
this error comes from the ClassDesigner, in the onRunDesign() method.

Are you editing your bizobj using the Class Designer? Are you putting 
the DefaultValues setting in the bizobj's initProperties() method?

Does that error occur as soon as you make the setting or only when you 
try to run your design? If the latter, don't run your design from within 
the Class Designer but do it from the command line by running your app.

I'm not sure if the above is the best advice. Perhaps Ed will chime in 
with better help.

>> Test to see by asking the bizobj:
>>   print biz.getFieldVal(fieldname)
>>
> 
> I'm not sure what you mean by this.  Where should I put that?

Anywhere that you have a reference to your bizobj. Perhaps in your 
form's afterInitAll():

def afterInitAll():
   biz = self.PrimaryBizobj
   print biz.getFieldVal(fieldname)
   print biz.DefaultValues

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