[omniORB] sequuence of Object in omniPy

Jerome Kerdreux Jerome.Kerdreux at finix.eu.org
Mon Aug 4 15:25:15 BST 2003


Hi all, after  a long time writing code w/ omniPy i got a question :

Here is my idl  :
=====================================
module Ametsa{

 exception DeviceException{string details;};
 interface Device
 {
   string getName() raises(DeviceException);
 };

 typedef sequence<Device> Devices;
 interface CtrlPoint
 {
   Devices getDevices();
 };
};
======================================

As you can see cltrlPoint.getDevices() should return
a sequence of Device Object. so I write something like
this on the servant side :

class Device_i(Ametsa__POA.Device):
   def __init__(self,device):
       self._device = device

   def getName(self):
       return self._device.getFriendlyName()

class CtrlPoint_i(Ametsa__POA.CtrlPoint):
   def __init__(self,ctrlPoint):
       self._ctrlPoint = ctrlPoint

   def getDevices(self):
       result = []
       for dev in self._ctrlPoint.getDevices():
           result.append( Device_i( dev ) )
       return result


but when i try to use it in the client i get this :
Traceback (most recent call last):
 File "client.py", line 52, in ?
   cltp.getDevices()
 File "ametsa_idl.py", line 122, in getDevices
   return _omnipy.invoke(self, "getDevices", 
_0_Ametsa.CtrlPoint._d_getDevices, args)
omniORB.CORBA.BAD_PARAM: Minor: BAD_PARAM_WrongPythonType, COMPLETED_MAYBE.

So .. this doesn't really hurt me since i return a list of device object 
not a "Devices", so
my question is : how should i write the getDevices() method.


I read the omnyPy tutorial but found nothing about that ..


Thanks for any Help




More information about the omniORB-list mailing list