コード例 #1
0
ファイル: env.py プロジェクト: jianchen2580/nitrate-xmlrpc
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': is_active }
    if env_group_id: query['group__pk'] = env_group_id

    return TCMSEnvProperty.to_xmlrpc(query)
コード例 #2
0
ファイル: env.py プロジェクト: jianchen2580/nitrate-xmlrpc
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'})
    """
    return TCMSEnvProperty.to_xmlrpc(query)