TyrantWave
TyrantWave

Reputation: 4673

Python Ladon can't return Lists

I'm setting up a Ladon SOAP server, and can't get it to return lists at all.

Here's what I have:

class V1(object):
    """
    This service returns events between two times for a given trackable.
    """
    @ladonize(rtype=[ PORTABLE_STRING ])
    def getGroupNames(self):
        """
        Returns a list of group names.
        @rtype: List of group names.
        """
        cnn = db.get_connection()
        sql = "blah blah sql"
        params = {}
        groups = db.execute_fetchall(cnn, sql, params)
        ret = []
        for g in groups:
            ret += [g["group_description"]]
        return ret

And the error I'm getting is:

WebFault: Server raised fault: 'Return-type mismatch in V1::getGroupNames: Expected [<type 'unicode'>] recieved <type 'list'>'

It's expecting a list of unicode, and I'm returning a list of unicode, but it's adamant those aren't the same thing.

What am I missing?

Upvotes: 0

Views: 248

Answers (1)

asthasr
asthasr

Reputation: 9417

I haven't used (or heard of) Ladon before this, but it looks like the validation logic is pretty naive. It appears to simply compare type(a) == type(b), which means that, no, you won't be able to describe complex types directly. I think that what you want is called LadonType; see the documentation.

Upvotes: 0

Related Questions