TypesΒΆ

The default mapping of an entity can be overriden. Below is an example with CWUser and CWGroup.

Note

The webservice types are not autoregistered by the registry, hence an explicit registering is needed. The cubes.wsme.types.scan() function makes things easier if many types are defined in the same module.

from cubes.wsme.types import Base, wsattr, scan

class CWUser(Base):
    login = wsattr('login', datatype=wsme.types.text)
    password = wsattr('upassword', datatype=wsme.types.text)

    in_group = wsattr('in_group', datatype=['CWGroup'])

class CWGroup(Base):
    name = wsattr('name', datatype=wsme.types.text)

    users = wsattr('in_group', role='subject', datatype=[CWUser])


def register_callback(vreg):
    scan(vreg, __name__)