Beispiel #1
0
def try_old_website(request, path):
    """
    Before returning a 404 page not found, check if path is at old website.
    """
    url = settings.OLD_SITE_DOMAIN + "/" + path

    if http_response_ok(url):
        return HttpResponsePermanentRedirect(url)
    else:
        raise Http404
Beispiel #2
0
def experiment_well(request, pk):
    """Render the page to see a particular experiment well."""
    experiment = get_object_or_404(Experiment, pk=pk)

    if (request.POST.get('toggle-junk') and
            request.user.has_perm('experiments.change_experiment')):
        experiment.toggle_junk()
        return redirect('experiment_well_url', experiment.pk)

    devstar_url = experiment.get_image_url(mode='devstar')
    devstar_available = http_response_ok(devstar_url)

    context = {
        'experiment': experiment,
        'devstar_available': devstar_available,

        # Default to full-size images
        'mode': request.GET.get('mode', 'big')
    }

    return render(request, 'experiment_well.html', context)
Beispiel #3
0
def experiment_well(request, pk):
    """Render the page to see a particular experiment well."""
    experiment = get_object_or_404(Experiment, pk=pk)

    if (request.POST.get('toggle-junk')
            and request.user.has_perm('experiments.change_experiment')):
        experiment.toggle_junk()
        return redirect('experiment_well_url', experiment.pk)

    devstar_url = experiment.get_image_url(mode='devstar')
    devstar_available = http_response_ok(devstar_url)

    context = {
        'experiment': experiment,
        'devstar_available': devstar_available,

        # Default to full-size images
        'mode': request.GET.get('mode', 'big')
    }

    return render(request, 'experiment_well.html', context)
Beispiel #4
0
 def test_get_wormbase_url(self):
     worms = self.get_worms()
     for worm in worms:
         self.assertTrue(http_response_ok(worm.get_wormbase_url()))