Beispiel #1
0
def long_description_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_config_form'] = forms.ConfigForm()
    data['git_config_error_message'] = ''
    if request.method == 'POST':
        form = forms.ConfigForm(request.POST)
        if form.is_valid():
            controllers.set_mission_completed(request.user.get_profile(), 'git_config')
            return HttpResponseRedirect(reverse(long_description))

    data['git_config_form'] = form
    return long_description(request, data)
Beispiel #2
0
def rebase_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_rebase_form'] = forms.RebaseForm()
    data['git_rebase_error_message'] = ''
    if request.method == 'POST':
        form = forms.RebaseForm(request.POST)
        if form.is_valid():
            if form.cleaned_data['secret_word'].lower() == 'pinky':
                controllers.set_mission_completed(request.user.get_profile(), 'git_rebase')
                return HttpResponseRedirect(reverse(rebase))
            else:
                data['git_rebase_error_message'] = "The author's name is incorrect."
        data['git_rebase_form'] = form
    return rebase(request, data)
Beispiel #3
0
def diff_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_diff_form'] = forms.DiffForm()
    data['git_diff_error_message'] = ''
    if request.method == 'POST':
        form = forms.DiffForm(request.POST)
        if form.is_valid():
                if controllers.GitDiffMission.validate_diff_and_commit_if_ok(request.user.username, form.cleaned_data['diff']):
                    controllers.set_mission_completed(request.user.get_profile(), 'git_diff')
                    return HttpResponseRedirect(reverse(diff))
                else:
                    data['git_diff_error_message'] = "The patch file is incorrect.  Give it another try!"
        data['git_diff_form'] = form
    return diff(request, data)
Beispiel #4
0
def diff_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_diff_form'] = forms.DiffForm()
    data['git_diff_error_message'] = ''
    if request.method == 'POST':
        form = forms.DiffForm(request.POST)
        if form.is_valid():
                if controllers.GitDiffMission.commit_if_ok(request.user.username, form.cleaned_data['diff']):
                    controllers.set_mission_completed(request.user.get_profile(), 'git_diff')
                    return HttpResponseRedirect(reverse(diff))
                else:
                    data['git_diff_error_message'] = "Unable to commit the patch. Please check your patch and try again "
        data['git_diff_form'] = form
    return diff(request, data)
Beispiel #5
0
def rebase_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_rebase_form'] = forms.RebaseForm()
    data['git_rebase_error_message'] = ''
    if request.method == 'POST':
        form = forms.RebaseForm(request.POST)
        if form.is_valid():
            if form.cleaned_data['secret_word'].lower() == 'pinky':
                controllers.set_mission_completed(request.user.get_profile(),
                                                  'git_rebase')
                return HttpResponseRedirect(reverse(rebase))
            else:
                data[
                    'git_rebase_error_message'] = "The author's name is incorrect."
        data['git_rebase_form'] = form
    return rebase(request, data)
Beispiel #6
0
def diff_submit(request):
    # Initialize data array and some default values.
    data = {}
    data['git_diff_form'] = forms.DiffForm()
    data['git_diff_error_message'] = ''
    if request.method == 'POST':
        form = forms.DiffForm(request.POST)
        if form.is_valid():
            if controllers.GitDiffMission.validate_diff_and_commit_if_ok(
                    request.user.username, form.cleaned_data['diff']):
                controllers.set_mission_completed(request.user.get_profile(),
                                                  'git_diff')
                return HttpResponseRedirect(reverse(diff))
            else:
                data[
                    'git_diff_error_message'] = "The patch file is incorrect.  Give it another try!"
        data['git_diff_form'] = form
    return diff(request, data)