def month(request, year, month, queryset=None,
    template_name="jellyroll/calendar/month.html", template_loader=loader,
    extra_context=None, context_processors=None, mimetype=None):
    # Make sure we've requested a valid month
    try:
        date = datetime.date(*time.strptime(year+month, '%Y%b')[:3])
    except ValueError:
        raise Http404("Invalid month string")
    try:
        first = Item.objects.order_by("timestamp")[0]
    except IndexError:
        raise Http404("No items; no views.")
    
    # Calculate first and last day of month, for use in a date-range lookup.
    today = datetime.date.today()
    first_day = date.replace(day=1)
    if first_day.month == 12:
        last_day = first_day.replace(year=first_day.year + 1, month=1)
    else:
        last_day = first_day.replace(month=first_day.month + 1)
    
    if first_day < first.timestamp.date().replace(day=1) or date > today:
        raise Http404("Invalid month (%s .. %s)" % (first.timestamp.date(), today))
    
    # Calculate the previous month
    previous = (first_day - datetime.timedelta(days=1)).replace(day=1)
    previous_link = urlresolvers.reverse("jellyroll.views.calendar.month", args=previous.strftime("%Y %b").lower().split())
    if previous < first.timestamp.date().replace(day=1):
        previous = None
    
    # And the next month
    next = last_day + datetime.timedelta(days=1)
    next_link = urlresolvers.reverse("jellyroll.views.calendar.month", args=next.strftime("%Y %b").lower().split())
    if next > today:
        next = None
        
    # Handle the initial queryset
    if not queryset:
        queryset = Item.objects.all()
    queryset = queryset.filter(timestamp__range=(first_day, last_day))
    if not queryset.query.order_by:
        queryset = queryset.order_by("timestamp")
    
    # Build the context
    context = RequestContext(request, {
        "items"         : queryset,
        "month"         : date,
        "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)
; not yet supported
dataset/ETHPy150Open jacobian-archive/jellyroll/src/jellyroll/views/calendar.py/month--crossover with--dataset/ETHPy150Open samth/pycket/pycket/test/test_arithmetic.py/test_string_to_number