[Django] #24360: when LocaleMiddleware activated, no error page with traceback and error message in logger

42 views
Skip to first unread message

Django

unread,
Feb 17, 2015, 5:07:40 PM2/17/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------+--------------------
Reporter: mishust | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Steps to reproduce:
1. include in MIDDLEWARE_CLASSES
'django.middleware.locale.LocaleMiddleware',
2. Make error in code (for example addind 'f' symbol)

urlpatterns = patterns('',
f
url(r'^admin/', include(admin.site.urls)),
3. Open root page http://mysite/

Result: "A server error occurred. Please contact the administrator." HTML
page
and Traceback on concole output

Expected result: with Debug=True expecting to see HTML error page with
Traceback and detailed info.

Also, error message dont appear in python logger - in files, not send to
ADMIN emails.

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

Django

unread,
Feb 17, 2015, 5:10:58 PM2/17/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------+--------------------------------------

Reporter: mishust | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by mishust):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> Steps to reproduce:
> 1. include in MIDDLEWARE_CLASSES
> 'django.middleware.locale.LocaleMiddleware',
> 2. Make error in code (for example addind 'f' symbol)
>
> urlpatterns = patterns('',
> f
> url(r'^admin/', include(admin.site.urls)),
> 3. Open root page http://mysite/
>
> Result: "A server error occurred. Please contact the administrator."
> HTML page
> and Traceback on concole output
>
> Expected result: with Debug=True expecting to see HTML error page with
> Traceback and detailed info.
>
> Also, error message dont appear in python logger - in files, not send to
> ADMIN emails.

New description:

Steps to reproduce:
1. include in MIDDLEWARE_CLASSES
'django.middleware.locale.LocaleMiddleware',
2. Make error in code (for example addind 'f' symbol)

urlpatterns = patterns('',
f
url(r'^admin/', include(admin.site.urls)),
3. Open root page http://mysite/

Result: "A server error occurred. Please contact the administrator." HTML
page
and Traceback on concole output

Expected result: with Debug=True expecting to see HTML error page with
Traceback and detailed info.

Also, error message dont appear in python logger - in files, not send to
ADMIN emails.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:1>

Django

unread,
Feb 17, 2015, 5:19:28 PM2/17/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------+--------------------------------------

Reporter: mishust | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by mishust):

Same problem report: http://grokbase.com/t/gg/django-users/148bk4yant
/adding-localemiddleware-does-not-show-pretty-error-pages

--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:2>

Django

unread,
Feb 18, 2015, 8:26:45 AM2/18/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------+--------------------------------------
Reporter: mishust | Owner: gregorth
Type: Bug | Status: assigned
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by gregorth):

* owner: nobody => gregorth
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:3>

Django

unread,
Mar 2, 2015, 4:57:48 AM3/2/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------+--------------------------------------
Reporter: mishust | Owner:

Type: Bug | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by gregorth):

* owner: gregorth =>
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:4>

Django

unread,
Mar 2, 2015, 5:52:42 AM3/2/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
------------------------------+------------------------------------
Reporter: mishust | Owner:
Type: Bug | Status: new
Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by claudep):

* component: Uncategorized => Core (Other)
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:5>

Django

unread,
Mar 2, 2015, 6:16:46 AM3/2/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
------------------------------+------------------------------------
Reporter: mishust | Owner:
Type: Bug | Status: new

Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


Comment:

The problem appears when a middleware fails in its `__init__` method. In
the `LocaleMiddleware` use case, it can easily be workarounded by
transforming `is_language_prefix_patterns_used` into a cached property,
like this:
https://github.com/django/django/pull/4224

--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:6>

Django

unread,
Mar 2, 2015, 7:18:31 AM3/2/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------------+-------------------------------------
Reporter: mishust | Owner:
Type: Bug | Status: new

Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:7>

Django

unread,
Mar 2, 2015, 2:07:06 PM3/2/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------------+-------------------------------------
Reporter: mishust | Owner: Claude
| Paroz <claude@…>
Type: Bug | Status: closed

Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* owner: => Claude Paroz <claude@…>
* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"80be597a7b2530ec0893e1d9ee8275e281f026dc"]:
{{{
#!CommitTicketReference repository=""
revision="80be597a7b2530ec0893e1d9ee8275e281f026dc"
Fixed #24360 -- Delayed internal LocaleMiddleware variable initialization

Failing in a middleware `__init__` is preventing proper debug view.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:8>

Django

unread,
Mar 6, 2015, 3:34:10 AM3/6/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------------+-------------------------------------
Reporter: mishust | Owner: Claude
| Paroz <claude@…>
Type: Bug | Status: closed
Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by peterfarrell):

Just wanted to add to this ticket for those stuck with
django.db.utils.OperationalError: SSL SYSCALL errors. Using the fix in
master (which I assume will be in 1.7.6) fixes the issue.

{{{
00:50:04.391 2015-03-06 06:50:04.020323+00:00 app web.1 - -
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-
packages/django/core/handlers/wsgi.py", line 168, in __call__
self.load_middleware()
File "/app/.heroku/python/lib/python2.7/site-
packages/django/core/handlers/base.py", line 46, in load_middleware
mw_instance = mw_class()
File "/app/.heroku/python/lib/python2.7/site-
packages/django/middleware/locale.py", line 23, in __init__
for url_pattern in get_resolver(None).url_patterns:
File "/app/.heroku/python/lib/python2.7/site-
packages/django/core/urlresolvers.py", line 372, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/core/urlresolvers.py", line 366, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37,
in import_module
__import__(name)
File "./verde/urls.py", line 22, in <module>
(r'^verdeadmin/', include(admin.site.urls)),
File "/app/.heroku/python/lib/python2.7/site-
packages/django/contrib/admin/sites.py", line 262, in urls
return self.get_urls(), self.app_name, self.name
File "/app/.heroku/python/lib/python2.7/site-
packages/django/contrib/admin/sites.py", line 246, in get_urls
url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name),
include(model_admin.urls))
File "/app/.heroku/python/lib/python2.7/site-
packages/django/contrib/admin/options.py", line 598, in urls
return self.get_urls()
File "/app/.heroku/python/lib/python2.7/site-
packages/cms/admin/pageadmin.py", line 145, in get_urls
url_patterns += super(PageAdmin, self).get_urls()
File "/app/.heroku/python/lib/python2.7/site-
packages/cms/admin/placeholderadmin.py", line 131, in get_urls
from cms.urls import SLUG_REGEXP
File "/app/.heroku/python/lib/python2.7/site-packages/cms/urls.py", line
20, in <module>
urlpatterns = get_app_patterns()
File "/app/.heroku/python/lib/python2.7/site-
packages/cms/appresolver.py", line 191, in get_app_patterns
current_site = Site.objects.get_current()
File "/app/.heroku/python/lib/python2.7/site-
packages/django/contrib/sites/models.py", line 54, in get_current
current_site = self.get(pk=sid)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/manager.py", line 92, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/query.py", line 351, in get
num = len(clone)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/query.py", line 122, in __len__
self._fetch_all()
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/query.py", line 966, in _fetch_all
self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/query.py", line 265, in iterator
for row in compiler.results_iter():
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/sql/compiler.py", line 700, in results_iter
for rows in self.execute_sql(MULTI):
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/models/sql/compiler.py", line 786, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python2.7/site-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
django.db.utils.OperationalError: SSL SYSCALL error: EOF detected
Exception
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:9>

Django

unread,
Mar 6, 2015, 4:19:47 AM3/6/15
to django-...@googlegroups.com
#24360: when LocaleMiddleware activated, no error page with traceback and error
message in logger
-------------------------------------+-------------------------------------
Reporter: mishust | Owner: Claude
| Paroz <claude@…>
Type: Bug | Status: closed
Component: Core (Other) | Version: 1.7
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

Note that this has only been committed to the master branch (targeting
1.9).

--
Ticket URL: <https://code.djangoproject.com/ticket/24360#comment:10>

Reply all
Reply to author
Forward
0 new messages