[omniORB] type checking

Ridgway, Richard (London) Richard_Ridgway at ml.com
Thu Jul 3 19:50:56 BST 2008


I use something like this decorator (borrowed from pyExcelerator. I
think I've seen similar but more convoluted example in zope?). Not quite
what you want, but maybe workable.

def returns(t):
  def check_returns(f):
    def new_f(*args,**kwds):
      val = f(*args,**kwds)
      assert isinstance(val,t)
      return val
    return new_f
  return check_returns

@returns(str)
def bob():
  return "string"

@returns(str)
def bob_not_str():
  return 1

>>> bob()
'string'

>>> bob_not_str()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in new_f
AssertionError



-----Original Message-----
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of Michael
Brenner
Sent: 03 July 2008 17:39
To: omniorb-list at omniorb-support.com
Subject: [omniORB] type checking


Hi,

I'm calling a python server from a java client.  Is there a way I can
type check 
the return values in python, ie assert that they confirm to the out
parameters 
specified in the IDL, and die gracefully (and with a helful message) if
they 
don't?  Right now, I'm getting org.omg.CORBA.BAD_PARAM errors - which
don't give 
me any clue about what went wrong.

Cheers,

     michael

_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------



More information about the omniORB-list mailing list