{{{
class Class(object):
__slots__ = ['attr']
def __init__(self, attr):
self.attr = attr
def __call__(self):
pass
INSTANCE = Class(1)
}}}
The error that prevents the 500 error page from rendering is:
{{{
Traceback (most recent call last):
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py",
line 85, in run
self.result = application(self.environ, self.start_response)
File "venv/lib/python2.7/site-
packages/django/contrib/staticfiles/handlers.py", line 64, in __call__
return self.application(environ, start_response)
File "venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
line 191, in __call__
response = self.get_response(request)
File "venv/lib/python2.7/site-packages/django/core/handlers/base.py",
line 198, in get_response
response = self.handle_uncaught_exception(request, resolver,
sys.exc_info())
File "venv/lib/python2.7/site-packages/django/core/handlers/base.py",
line 241, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "venv/lib/python2.7/site-packages/django/views/debug.py", line 79,
in technical_500_response
html = reporter.get_traceback_html()
File "venv/lib/python2.7/site-packages/django/views/debug.py", line 337,
in get_traceback_html
c = Context(self.get_traceback_data(), use_l10n=False)
File "venv/lib/python2.7/site-packages/django/views/debug.py", line 315,
in get_traceback_data
'settings': get_safe_settings(),
File "venv/lib/python2.7/site-packages/django/views/debug.py", line 65,
in get_safe_settings
settings_dict[k] = cleanse_setting(k, getattr(settings, k))
File "venv/lib/python2.7/site-packages/django/views/debug.py", line 55,
in cleanse_setting
cleansed.do_not_call_in_templates = True
AttributeError: 'Class' object has no attribute 'do_not_call_in_templates
}}}
For me, this is a problem because I'm upgrading a project that stores what
time of the week certain things happen with instances of dateutil's
weekday object in the settings. Reproduced in 1.7c1 and current master,
never happened in 1.6. I can probably work around it, but it'll be
upsettingly inelegant.
--
Ticket URL: <https://code.djangoproject.com/ticket/23070>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Could you bisect Django's history to the commit that introduced the
change?
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:1>
Comment (by anonymous):
https://github.com/django/django/commit/3c5cdaf47aae7e4f21398be1a5eaa07f7c5ce31c
Would it be unreasonable to have cleanse_setting return a repr() or a
str() (or unicode()) of the settings rather than the things themselves?
That way it has direct control over whether or not they are called and
doesn't have to rely on attempting to set attributes on objects that could
be a type for all it knows.
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:2>
Comment (by anonymous):
Any object that cannot have the 'do_not_call_in_templates' attribute set
on being set in settings will cause this issue, by the way; you can also
cause it by using types or exceptions::
{{{
SCORE_NUMBER_TYPE = int
PASSABLE_EXCEPTION = ValueError
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:3>
* cc: bmispelon (added)
* component: Uncategorized => Core (Other)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
CCing Baptiste since he committed the change. Perhaps he can offer
guidance.
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:4>
* status: new => assigned
* owner: nobody => hirokiky
Comment:
trying
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:5>
* cc: hirokiky@… (added)
* has_patch: 0 => 1
Comment:
I added patch to solve it.
On this change it solve by using `force_text` instead of adding
`do_not_call_in_template`.
And also I added screen shots when the patch is applied.
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:6>
* needs_better_patch: 0 => 1
Comment:
This means that the debug page gives the wrong information
(`ADDED_CALLABLE` is a function object but the page says it's a string).
We need to find a different approach.
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:7>
* needs_better_patch: 1 => 0
Comment:
@bmispelon Thanks for the review
I fixed it and sent pull-request
[https://github.com/django/django/pull/2967].
Now the setting value appearing the debug page is valid.
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"63058786882f6a32649a0fdafae9cb425c95cd4e"]:
{{{
#!CommitTicketReference repository=""
revision="63058786882f6a32649a0fdafae9cb425c95cd4e"
Merge pull request #2967 from hirokiky/fix23070
Fixed #23070 -- not to break the debug page by callable setting with
__slots__
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23070#comment:9>