#12750: Middleware snippet getting error in 1.2 alpha 1 - AttributeError:
'MethodDecoratorAdaptor' object has no attribute 'func_code
-----------------------------------+----------------------------------------
 Reporter:  phoebebright           |       Owner:  nobody    
   Status:  new                    |   Milestone:            
Component:  Uncategorized          |     Version:  1.2-alpha 
 Keywords:  middleware, decorator  |       Stage:  Unreviewed
Has_patch:  0                      |  
-----------------------------------+----------------------------------------
 Section of code causing error:

        from django.core.urlresolvers import resolve
         view_func, args, kwargs = resolve(request.META['PATH_INFO'])

          if hasattr(view_func,'view_func'):
             # it the view_func has a view_func then its a decorator
             co = view_func.view_func.func_code
         else:
             co = view_func.func_code   <---- fails here


 Traceback:
 Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/servers/basehttp.py", line 280, in run
     self.result = application(self.environ, self.start_response)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/servers/basehttp.py", line 672, in __call__
     return self.application(environ, start_response)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/handlers/wsgi.py", line 245, in __call__
     response = middleware_method(request, response)
   File
 "/Users/phoebebr/Development/tinycomms/tinycomm/debug_middleware.py", line
 117, in process_response
     co = view_func.func_code
 AttributeError: 'MethodDecoratorAdaptor' object has no attribute
 'func_code'
 [01/Feb/2010 17:38:49] "GET /who/availability/ HTTP/1.1" 500 841

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12750>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to