def filter_versions(request, query): """ Description: Performs a search and returns the resulting list of versions. Params: $query - Hash: keys must match valid search fields. +------------------------------------------------------------------+ | Component Search Parameters | +------------------------------------------------------------------+ | Key | Valid Values | | id | Integer: ID of product | | value | String | | product | ForeignKey: Product | +------------------------------------------------------------------+ Returns: Array: Matching versions are retuned in a list of hashes. Example: # Get all of versions named like '2.4.0-SNAPSHOT' >>> Product.filter_versions({'value__icontains': '2.4.0-SNAPSHOT'}) # Get all of filter_versions named in product 'Red Hat Enterprise Linux 5' >>> Product.filter_versions({'product__name': 'Red Hat Enterprise Linux 5'}) """ from tcms.management.models import Version return Version.to_xmlrpc(query)
def filter(query): # pylint: disable=redefined-builtin """ .. function:: XML-RPC Version.filter(query) Search and returns the resulting list of versions. :param query: Field lookups for :class:`tcms.management.models.Version` :type query: dict :return: List of serialized :class:`tcms.management.models.Version` objects :rtype: list(dict) """ return Version.to_xmlrpc(query)
def get_versions(request, product): """Get the list of versions associated with this product. :param product: product ID or name. :type product: int or str :return: a list of mappings of versions. :rtype: list Example:: # Get with product id >>> Product.get_versions(1) # Get with product name >>> Product.get_versions('product name') """ from tcms.management.models import Version p = pre_check_product(values=product) query = {'product': p} return Version.to_xmlrpc(query)
def get_versions(request, product): """ Description: Get the list of versions associated with this product. Params: $product - Integer/String Integer: product_id of the product in the Database String: Product name Returns: Array: Returns an array of Version objects. Example: # Get with product id >>> Product.get_runs(61) # Get with product name >>> Product.get_runs('Red Hat Enterprise Linux 5') """ from tcms.management.models import Version p = pre_check_product(values=product) query = {'product': p} return Version.to_xmlrpc(query)
def filter_versions(request, query): """Performs a search and returns the resulting list of versions. :param dict query: a mapping containing following criteria. * id: (int) ID of product * value: (str) version value. * product: ForeignKey: :class:`Product`. :return: a list of mappings of :class:`Version`. :rtype: list Example:: # Get all of versions named like '2.4.0-SNAPSHOT' >>> Product.filter_versions({'value__icontains': '2.4.0-SNAPSHOT'}) # Get all of filter_versions named in product 'product name' >>> Product.filter_versions({'product__name': 'product name'}) """ from tcms.management.models import Version return Version.to_xmlrpc(query)