Source code for tcms.rpc.api.utils

# Copyright (c) 2019-2020 Alexander Todorov <>

# Licensed under the GPL 2.0:

from django.utils.module_loading import import_string

from tcms.testcases.models import BugSystem

[docs]def tracker_from_url(url, request): """ Return the IssueTrackerType object for the system where ``base_url`` is part of ``url``. Usually we pass URLs to pre-existing defects to this method. """ for bug_system in BugSystem.objects.all(): if bug_system.base_url and url.startswith(bug_system.base_url): return import_string(bug_system.tracker_type)(bug_system, request) return None