b63886addf175201fe2d284c5267e232c670d3bf,app/grandchallenge/core/contextprocessors/contextprocessors.py,,comic_site,#,11

Before Change


    figure it out. Use main project. 
    
    
    try:
        resolution = resolve(request.path)
    except Http404 as e:
        // fail silently beacuse any exeception here will cause a 500 server
        // error on page. Let views show errors but not the context processor
        resolution = resolve("/")

    challenge_short_name = resolution.kwargs.get(
        "challenge_short_name", settings.MAIN_PROJECT_NAME
    )

    try:
        challenge = Challenge.objects.get(
            short_name__iexact=challenge_short_name
        )
        pages = challenge.page_set.all()
    except Challenge.DoesNotExist:
        // Don"t crash the system here, if a challenge cannot be found it will
        // crash in a more appropriate location

After Change


    except AttributeError:
        user = get_anonymous_user()

    if challenge is None:
        permissions = pages = []
        is_participant = False
    else:
        permissions = get_perms(user, challenge)
        pages = challenge.page_set.all()
        is_participant = challenge.is_participant(user)

    return {
        "site": challenge,
        "challenge_perms": permissions,
        "user_is_participant": is_participant,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: comic/grand-challenge.org
Commit Name: b63886addf175201fe2d284c5267e232c670d3bf
Time: 2018-12-03
Author: jamesmeakin@gmail.com
File Name: app/grandchallenge/core/contextprocessors/contextprocessors.py
Class Name:
Method Name: comic_site


Project Name: fperazzi/proSR
Commit Name: 6b7b82ff60b8ca7a26b50e50210a06a46bdc848a
Time: 2018-07-09
Author: fperazzi@adobe.com
File Name: lib/prosr/models/generators.py
Class Name: ProSR
Method Name: forward


Project Name: brian-team/brian2
Commit Name: 25ca9c249fd3e11bb166b42ffeb2433036964bd1
Time: 2017-07-05
Author: charleetje@gmail.com
File Name: brian2/codegen/generators/GSL_generator.py
Class Name: GSLWeaveCodeGenerator
Method Name: write_dataholder