def year(request, year, queryset=None,
    template_name="jellyroll/calendar/year.html", template_loader=loader,
    extra_context=None, context_processors=None, mimetype=None):
    # Make sure we've requested a valid year
    year = int(year)
    try:
        first = Item.objects.order_by("timestamp")[0]
    except IndexError:
        raise Http404("No items; no views.")
    today = datetime.date.today()
    if year < first.timestamp.year or year > today.year:
        raise Http404("Invalid year (%s .. %s)" % (first.timestamp.year, today.year))
    
    # Calculate the previous year
    previous = year - 1
    previous_link = urlresolvers.reverse("jellyroll.views.calendar.year", args=[previous])
    if previous < first.timestamp.year:
        previous = previous_link = None
    
    # And the next year
    next = year + 1
    next_link = urlresolvers.reverse("jellyroll.views.calendar.year", args=[next])
    if next > today.year:
        next = next_link = None
        
    # Handle the initial queryset
    if not queryset:
        queryset = Item.objects.all()
    queryset = queryset.filter(timestamp__year=year)
    if not queryset.query.order_by:
        queryset = queryset.order_by("timestamp")
        
    # Build the context
    context = RequestContext(request, {
        "items"         : queryset.filter(timestamp__year=year).order_by("timestamp"),
        "year"          : year,
        "previous"      : previous,
        "previous_link" : previous_link,
        "next"          : next,
        "next_link"     : next_link
    }, context_processors)
    if extra_context:
        for key, value in extra_context.items():
            if callable(value):
                context[key] = value()
            else:
                context[key] = value
    
    # Load, render, and return
    t = template_loader.get_template(template_name)
    return HttpResponse(t.render(context), mimetype=mimetype)
Escape context to be able to calculate hash of a (source_entity, context).
dataset/ETHPy150Open jacobian-archive/jellyroll/src/jellyroll/views/calendar.py/year--crossover with--dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/formats/utils/hash_tag.py/escape_context