Exemplo n.º 1
0
def increment(request):
    if request.method == 'POST':
        counter = request.POST['counter']
    if counter == 'simple':
        SimpleCounterShard.increment()
    else:
        GeneralCounterShard.increment('FOO')
    return HttpResponseRedirect('/show/')
Exemplo n.º 2
0
def increment(request):
    if request.method == 'POST':
        counter = request.POST['counter']
    if counter == 'simple':
      SimpleCounterShard.increment()
    else:
      GeneralCounterShard.increment('FOO')
    return HttpResponseRedirect('/show/')
Exemplo n.º 3
0
def show(request):
    template_context = {
      'simpletotal': SimpleCounterShard.get_count(),
      'generaltotal': GeneralCounterShard.get_count('FOO')
    }
    return render_to_response('sharded_counters/counter.html', template_context,
        context_instance=RequestContext(request))
Exemplo n.º 4
0
def show(request):
    template_context = {
        'simpletotal': SimpleCounterShard.get_count(),
        'generaltotal': GeneralCounterShard.get_count('FOO')
    }
    return render_to_response('sharded_counters/counter.html',
                              template_context,
                              context_instance=RequestContext(request))