There seems to be a bug with the implementation of ParametersI in python. Seems there just one object created in the global scope, like a singleton. Here's an example:
- Code: Select all
from omero_sys_ParametersI import ParametersI
def foo():
params_foo = ParametersI().addLong('foo', 1)
print "********** Params in foo **********"
print params_foo
if __name__ == "__main__":
foo()
params = ParametersI()
params.addLong('bar', 2)
params2 = ParametersI()
params2.addLong('foobar', 3)
print "********** Params in main **********"
print params2
The output looks like this:
- Code: Select all
********** Params in foo **********
object #0 (::omero::sys::Parameters)
{
map =
{
key = foo
value = object #1 (::omero::RLong)
{
_val = 1
}
}
theFilter = <nil>
theOptions = <nil>
}
********** Params in main **********
object #0 (::omero::sys::Parameters)
{
map =
{
key = foobar
value = object #1 (::omero::RLong)
{
_val = 3
}
key = foo
value = object #2 (::omero::RLong)
{
_val = 1
}
key = bar
value = object #3 (::omero::RLong)
{
_val = 2
}
}
theFilter = <nil>
theOptions = <nil>
}
I tested this with the Java implementation, too. It does not show this bug.
Cheers, Bernhard