﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12494	'module' object has no attribute when accessing settings	Phoebe Bright	nobody	"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'
}}}
"		closed	Uncategorized	1.1		invalid			Unreviewed	0	0	0	0	0	0
