Archived

This forum has been archived. Please start a new discussion on GitHub.

Slice bool always maps to True in python server

The slice bool varable always maps to true in python.
Even if the value is being set to false, it becomes True in python server.

But if the field is declared as string in slice and set to false, the false value is retained in python server.

Comments

  • mes
    mes California
    Hi,

    I am not able to reproduce this problem. If you want us to investigate this further, please provide the following information:
    • the version of Ice and Python you are using
    • your operating system version
    • a small example that demonstrates the problem
    Thanks,
    - Mark
  • Hi,

    version of Ice - 2.1.2
    python version - 2.3.5
    operating system version - Debian Gnu/Linux - 2.6.8-2-686

    here is a small example:

    slice :
    module Foo {
        class Bar {
            int id;
            bool status;
            string name;
        };
     
        interface UpdateValues {
             void submit (Bar b);
        };
    };
    
    corresponding python client code:
    def run(argv, communicator):
        query = IcePack.QueryPrx.checkedCast(communicator.stringToProxy('IcePack/Query'))
        base = query.findObjectByType("::Foo::UpdateValues")
        x = Foo.UpdateValuesPrx.checkedCast(base)
    
        rec = Foo.Bar()
        rec.id = 123
        rec.status = 'False'
        rec.name = 'some name'
        
        x.update(rec)
    
    props = Ice.createProperties()
    props.load('/etc/prh/ice.conf')
    communicator = Ice.initializeWithProperties(sys.argv, props)
    run(sys.argv, communicator)
    

    the false value gets mapped to true in the python server.
  • hi,

    i'm sorry with the previous post(bug report).
    Actuall it works fine if i remove the single quotes enclosing the bool value.

    i.e 'False' should have been written as False (without the quotes).

    sorry about that.