Example #1
0
def filter_properties(request, query):
    """
    Description: Performs a search and returns the resulting list of env properties.

    Params:      $query - Hash: keys must match valid search fields.

    +------------------------------------------------------------------+
    |               Product Search Parameters                          |
    +------------------------------------------------------------------+
    |        Key          |          Valid Values                      |
    | id                  | Integer: ID of env properties              |
    | name                | String                                     |
    | is_active           | Boolean                                    |
    | group               | ForeignKey: TCMSEnvGroup                   |
    | value               | ForeignKey: TCMSEnvValues                   |
    +------------------------------------------------------------------+

    Returns:     Array: Matching env properties are retuned in a list of hashes.

    Example:
    # Get all of env properties name contains 'Desktop'
    >>> Env.filter_properties({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvProperty.to_xmlrpc(query)
Example #2
0
File: env.py Project: jetlyb/Kiwi
def filter_properties(query):
    """
    .. function:: XML-RPC Env.filter_properties(query)

        Performs a search and returns the resulting list of env properties.
        Parameter ``query`` is dict which recognizes the following
        keys:

        :param id: ID of env properties
        :type id: int
        :param name: Name of peroperty
        :type name: str
        :param is_active:
        :type is_active: bool
        :param group: ForeignKey: TCMSEnvGroup
        :type group: int or :class:`tcms.management.models.TCMSEnvGroup`
        :param value: ForeignKey: TCMSEnvValues
        :type value: int or :class:`tcms.management.models.TCMSEnvValues`
        :returns: List of serialized env properties matching the query
        :rtype: list(dict)

        For example to get all env properties containing 'Desktop'::

            >>> Env.filter_properties({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvProperty.to_xmlrpc(query)
Example #3
0
def filter(query):
    """
    .. function:: XML-RPC Env.Property.filter(query)

        Performs a search and returns the resulting list of environment properties.

        :param query: Field lookups for :class:`tcms.management.models.TCMSEnvProperty`
        :type query: dict
        :returns: List of serialized :class:`tcms.management.models.TCMSEnvProperty` objects
        :rtype: list(dict)
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvProperty.to_xmlrpc(query)
Example #4
0
def get_properties(request, env_group_id=None, is_active=True):
    """Get the list of properties associated with this env group.

    :param int env_group_id: env_group_id of the env group in the Database
        Return all of properties when the argument is not specified.
    :param bool is_active: If ``True``, only include builds. Default: ``True``.
    :return: list of found environment properties.
    :rtype: list

    Example::

        # Get all of properties
        >>> Env.get_properties()
        # Get the properties in group 10
        >>> Env.get_properties(10)
    """
    query = {'is_active': parse_bool_value(is_active)}
    if env_group_id:
        query['group__pk'] = env_group_id

    return TCMSEnvProperty.to_xmlrpc(query)
Example #5
0
def get_properties(request, env_group_id=None, is_active=True):
    """
    Description: Get the list of properties associated with this env group.

    Params:      $env_group_id - Integer: env_group_id of the env group in the Database
                                 Return all of properties when the argument is not specific.
                 $is_active    - Boolean: True to only include builds where is_active is true.
                                 Default: True
    Returns:     Array: Returns an array of env properties objects.

    Example:
    # Get all of properties
    >>> Env.get_properties()
    # Get the properties in group 10
    >>> Env.get_properties(10)
    """
    query = {'is_active': parse_bool_value(is_active)}
    if env_group_id:
        query['group__pk'] = env_group_id

    return TCMSEnvProperty.to_xmlrpc(query)
Example #6
0
def filter_properties(request, query):
    """Performs a search and returns the resulting list of env properties.

    :param dict query: mapping containing following criteria to find out
        environment properties.

        * id: (int) environment property ID.
        * name: (str) property name.
        * is_active: (bool) whether to find active properties.
        * group: ForeignKey: :class:`TCMSEnvGroup`
        * value: ForeignKey: :class:`TCMSEnvValues`

    :return: Array: Matching env properties are retuned in a list of hashes.

    Example::

        # Get all of env properties name contains 'Desktop'
        >>> Env.filter_properties({'name__icontains': 'Desktop'})
    """
    if 'is_active' in query:
        query['is_active'] = parse_bool_value(query['is_active'])
    return TCMSEnvProperty.to_xmlrpc(query)