title: TypeError: 'str' object is not callable (Django/Python)
body: <p>I am attempting to build a REST-type JSON API for my app, and while I'm testing it, I keep getting a cryptic error when I hit the URL of my page.</p>
  
  <p><strong>URLconf:</strong></p>
  
  <pre><code>url(r'^calendar/(?P&lt;id&gt;\d+)/(?P&lt;year&gt;\d+)/(?P&lt;month&gt;\d+)/$', 'calendar_resource'),
  </code></pre>
  
  <p><strong>views.py:</strong></p>
  
  <pre><code>def json_view(func):
      def wrapper(*args, **kwargs):
          result = func(*args, **kwargs)
          return HttpResponse(json.dumps(result), mimetype="text/json")
      return wrapper    
  
  @json_view
  def calendar_resource(request, id, month, year):
      if id != request.user.id:
          return HttpResponseForbidden()
      thisMonthEnd = datetime.datetime(year, month, calendar.mdays[month])
      thisMonthStart = datetime.datetime(year, month, 1)
      l = Lesson.objects.filter(student__teacher = request.user).filter(startDate__lte=thisMonthEnd).filter(endDate__gte=thisMonthSta‌​rt)
      lessonList = list(l)
      return lessonList
  </code></pre>
  
  <p>I'm converting the QuerySet result to a list so I can do more operations on it (i.e. insert records that wouldn't be returned in the query) before passing the list back as JSON for processing by fullCalendar.</p>
  
  <p>ETA: This is the <a href="https://stackoverflow.com/questions/1732452/django-ease-of-building-a-restful-interface">original question</a> that led me to use this implementation.</p>
  
  <p><strong>Traceback:</strong> </p>
  
  <pre><code>Environment:
  Request Method: GET
  Request URL: http://localhost:5678/calendar/1/2012/5/
  
  Django Version: 1.3.1
  Python Version: 2.6.5
  Installed Applications:
  ['django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.humanize',
   'django.contrib.sessions',
   'django.contrib.sites',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'django.contrib.admin',
   'lessons',
   'registration']
  Installed Middleware:
  ('django.middleware.csrf.CsrfViewMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware')
  
  
  Traceback:
  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
    111.                         response = callback(request, *callback_args, **callback_kwargs)
  
  Exception Type: TypeError at /calendar/1/2012/5/
  Exception Value: 'str' object is not callable
  </code></pre>