def pushElement(self, name):
        """ Change the level at which this :class:`MessageFormatter` is
        operating to the element specified by ``name``.

        After this returns, the context of the :class:`MessageFormatter` is set
        to the element specified by ``name`` in the schema and any calls to
        :meth:`setElement` or meth:`pushElement` are applied at that level.

        If ``name`` represents an array of scalars then :meth:`appendValue`
        must be used to add values.

        If ``name`` represents an array of complex types then
        :meth:`appendElement()` must be used.

        Args:
            name (Name or str): Specifies the :class:`blpapi.Element` on which
                to operate. The element must identify either a choice, a
                sequence or an array at the current level of the schema or the
                behavior is undefined.

        Raises:
            Exception: If the ``name`` is invalid for the current message or if
                the element identified by ``name`` has already been set.
        """
        if isstr(name):
            name = Name(conv2str(name))
        _ExceptionUtil.raiseOnError(
            internals.blpapi_MessageFormatter_pushElement(
                self.__handle, get_handle(name)))
    def setElement(self, name, value):
        """ Set the element with the specified ``name`` to the specified
        ``value`` in the current :class:`blpapi.Message` referenced by this
        :class:`MessageFormatter`.

        Args:
            name (Name or str): Identifies the element which will be set to
                ``value``.
            value (bool or str or int or float or datetime.date or \
                   datetime.time or datetime.datetime or Name or None):
                The value to assign to the specified element.

        Raises:
            Exception: An exception is raised if any of the following are true:
                - The ``name`` is invalid for the current message
                - The element identified by ``name`` has already been set
                - The ``value`` cannot be assigned to the element identified by
                    ``name``
        """
        if isstr(name):
            name = Name(conv2str(name))
        self._setElement(name, value)
Beispiel #3
0
def getAdminMessageDefinition(messageName):
    """ Return the definition for an admin message of the specified
    ``messageName``.

    Args:
        messageName (Name or str): The name of the desired admin message.

    Returns:
        SchemaElementDefinition: The element definition for the message
        specified by ``messageName``.

    Raises:
        Exception: If ``messageName`` does not name an admin message.
    """
    if isstr(messageName):
        messageName = Name(conv2str(messageName))
    rc, schema_element_definition_handle = \
        internals.blpapi_TestUtil_getAdminMessageDefinition(
            get_handle(messageName))
    _ExceptionUtil.raiseOnError(rc)
    schema_definition = \
        SchemaElementDefinition(schema_element_definition_handle, sessions=None)
    return schema_definition
 def _appendValueStr(self, value):
     """ Dispatch method for appending string types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_appendValueString(
             self.__handle, conv2str(value)))
 def _setElementStr(self, name, value):
     """ Dispatch method for setting string types. """
     _ExceptionUtil.raiseOnError(
         internals.blpapi_MessageFormatter_setValueString(
             self.__handle, get_handle(name), conv2str(value)))