c8f80caf3b3a5707a2d5d2b9dfee1e4e80f1b3be,django/comicsite/templatetags/comic_templatetags.py,comic_URLNode,render,#comic_URLNode#Any#,249

Before Change


        
        if subdomain_is_projectname:
            if hasattr(context["request"],"subdomain"):
                subdomain = context["request"].subdomain
            else:
                subdomain = ""

            if subdomain == "":
                //we are on the regular domain, do not change any links
                return url
            else:
                // Interpret subdomain as a comicsite. What would normally be the
                // path to this comicsite?

                // TODO: importing reverse function from two location is stinky 
                // refactor comicsite reverse so it can handle pages as well and
                // reverse the whole thing at once.
                path_to_site = reverse_djangocore("comicsite.views.site",args=[subdomain]).lower()

                if url.startswith(path_to_site):
                    return url.replace(path_to_site,"/")
                else:
                    // this url cannot use the domain name shortcut, so it is
                    // probably meant as a link the main comicframework site.
                    // in that case hardcode the domain to make sure the sub-
                    // domain is gone after following this link
                    return settings.MAIN_HOST_NAME + url
        else:
            return url

After Change


            // Interpret subdomain as a comicsite. What would normally be the
            // path to this comicsite?

            try:
                project = re.findall("^\/site\/([^\/]+)\/.*$", url)[0]

            except IndexError:
                // this url cannot use the domain name shortcut, so it is
                // probably meant as a link the main comicframework site.
                // in that case hardcode the domain to make sure the sub-
                // domain is gone after following this link
                return settings.MAIN_HOST_NAME + url

            url.replace("/site/" + project,"")

        return url
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: comic/grand-challenge.org
Commit Name: c8f80caf3b3a5707a2d5d2b9dfee1e4e80f1b3be
Time: 2017-05-09
Author: jamesmeakin@gmail.com
File Name: django/comicsite/templatetags/comic_templatetags.py
Class Name: comic_URLNode
Method Name: render


Project Name: MolSSI/QCEngine
Commit Name: 08840e2e0f962987c54faf9736f0896682961399
Time: 2020-06-25
Author: joshy1691@gmail.com
File Name: qcengine/programs/openmm.py
Class Name: OpenMMHarness
Method Name: _generate_openmm_system


Project Name: comic/grand-challenge.org
Commit Name: 44e7ef0b2b8218781b5fe7e2191b9790c42d73ec
Time: 2019-02-26
Author: code@jmsmkn.com
File Name: app/grandchallenge/container_exec/tasks.py
Class Name:
Method Name: validate_docker_image_async