On Wed, Oct 8, 2008 at 9:48 PM, Jesus M. Rodriguez <[EMAIL PROTECTED]> wrote:
> On Mon, Oct 6, 2008 at 3:22 PM, Jason Dobies <[EMAIL PROTECTED]> wrote:
>> I'm testing an API call with the python client. The return from the call
>> is a dictionary. Inside of that, there's a key "enabled" that should
>> either be true or false.
>>
>> When it's true, the output reflects that:
>>
>> [{'enabled': True, ...
>>
>> When it's false, I'm not getting an entry for "enabled".
>>
>> I took a look at the XML body of the response. For the true case, it's
>> sending:
>>
>> <member>
>>   <name>enabled</name>
>>   <value>
>>       <boolean>1</boolean>
>>   </value>
>> </member>
>>
>> For the false case, there is no entry.
>>
>> Is there something special I have to do to send a boolean false across
>> the wire? This feels like something we'd have seen before.
>>
>> Thanks,
>> - J
>>
>>
>> --
>
> It should work. I looked at the xmlrpc library code, and the relevant
> parts are here:
>
> XmlRpcSerializer (see where it does a "value instanceof Boolean"):
> http://xmlrpc.svn.sourceforge.net/viewvc/xmlrpc/trunk/source/redstone/xmlrpc/XmlRpcSerializer.java?view=markup
>
> Seems to convert boolean primitives here:
> http://xmlrpc.svn.sourceforge.net/viewvc/xmlrpc/trunk/source/redstone/xmlrpc/XmlRpcValue.java?view=markup
>
> I'll take a look to see why it's doing this. The xmlrpc spec states it
> should be 0 or 1. http://www.xmlrpc.com/spec
>
> jesus
>

Looks like it works just fine :) Here's what I did:

I added these 3 api methods to ApiHandler.java.

    public boolean isFalse() {
        return false;
    }

    public boolean isTrue() {
        return true;
    }

    public Map mapWithBoolean() {
       Map m = new HashMap();
       m.put("true_enabled", true);
       m.put("false_enabled", false);
       m.put("true_enabled_obj", Boolean.TRUE);
       m.put("false_enabled_obj", Boolean.FALSE);
       return m;
    }

My python client calls it like this:
print "--------------------------------------"
print client.api.is_false()
print "--------------------------------------"
print client.api.is_true()
print "--------------------------------------"
print client.api.map_with_boolean()

And here is the output:
http://fpaste.org/paste/7263

Maybe the serializer isn't properly passing the (B|b)oolean to the
child serializers.

jesus

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to