#12494: 'module' object has no attribute when accessing settings
---------------------------+------------------------------------------------
 Reporter:  phoebebright   |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  1.1       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 This was working in 1.1 but since updating to svn version I get the
 following error when referencing settings values.  Is there a new way of
 referencing settings?  Might be linked to problem with decorators
 described.  Can go back to earlier version if this is already in hand but
 wanted to record in case not.


 eg.
 from django.conf import settings   (also tried just import settings)
 print settings.FIRSTWEEKDAY

 Works fine in shell
 Works fine in some views in others get UnboundLocalError: local variable
 'settings' referenced before assignment - if I added the decorator
 @transaction.commit_on_success, however it works again.  If I use the
 @login_required decorator to see if it's decorators that's fixing it, I
 get AttributeError: 'MethodDecoratorAdaptor' object has no attribute
 'func_code' and this error also appears on some other pages which were
 previously working.

 Fails in api.py module with traceback below:
 urls.py

 {{{

 urlpatterns += patterns('libs.api',
 
url(r'^timeline/tweet/xml/(?P<filter_field>\w+)/(?P<filter_value>\w+)/$','timeline_tweet_xml',
 name='timeline_tweet_xml'),



 Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/servers/basehttp.py", line 651, 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 241, in __call__
     response = self.get_response(request)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/handlers/base.py", line 141, in get_response
     return self.handle_uncaught_exception(request, resolver, exc_info)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/handlers/base.py", line 165, in
 handle_uncaught_exception
     return debug.technical_500_response(request, *exc_info)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages/django/core/handlers/base.py", line 99, in get_response
     response = callback(request, *callback_args, **callback_kwargs)
   File "/Users/phoebebr/Development/tinycomms/libs/api.py", line 151, in
 timeline_tweet_xml
     print settings.FIRSTWEEKDAY
 AttributeError: 'module' object has no attribute 'FIRSTWEEKDAY'
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12494>
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 django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to