8a83f49303af120ef4ff122885f3a5b5b92c3aeb,app/grandchallenge/core/management/commands/importexcelprojects.py,Command,add_project_link_to_db,#Command#,57

Before Change


        if not challenge.logo:
            try:
                logo = f"https://grand-challenges.grand-challenge.org/serve/public_html/images/all_challenges/{challenge.short_name.lower()}.png/"
                img = urlopen(logo).read()
                challenge.logo = ContentFile(img,
                                             f"{challenge.short_name.lower()}.png")
            except HTTPError:
                print(f"Could not find logo for {challenge.short_name}")

After Change



        if not challenge.logo:
            try:
                logo = os.path.join(settings.MEDIA_ROOT,
                                    settings.MAIN_PROJECT_NAME,
                                    settings.EXTERNAL_PROJECTS_IMAGE_FOLDER,
                                    f"{challenge.short_name.lower()}.png")

                with open(logo, "rb") as f:
                    img = f.read()
                challenge.logo = ContentFile(img,
                                             f"{challenge.short_name.lower()}.png")
                
            except Exception:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: comic/grand-challenge.org
Commit Name: 8a83f49303af120ef4ff122885f3a5b5b92c3aeb
Time: 2018-08-01
Author: jamesmeakin@gmail.com
File Name: app/grandchallenge/core/management/commands/importexcelprojects.py
Class Name: Command
Method Name: add_project_link_to_db


Project Name: kk7nc/RMDL
Commit Name: 292510232cd2f32d498c032488c38215af4a1601
Time: 2018-04-19
Author: kk7nc@virginia.edu
File Name: setup.py
Class Name:
Method Name: readfile


Project Name: pmorissette/ffn
Commit Name: 740d0d9bb394ca7b6e7bd7af78da2211ab71bf83
Time: 2020-12-14
Author: t.paine154@gmail.com
File Name: setup.py
Class Name:
Method Name: