1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.

Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2008-08-06 15:32:46 +00:00
parent d06b474251
commit 34a3bd5225
33 changed files with 380 additions and 848 deletions

View File

@@ -9,7 +9,6 @@ from django import http
from django.core import signals
from django.core.handlers import base
from django.core.urlresolvers import set_script_prefix
from django.dispatch import dispatcher
from django.utils import datastructures
from django.utils.encoding import force_unicode
@@ -207,7 +206,7 @@ class WSGIHandler(base.BaseHandler):
self.initLock.release()
set_script_prefix(base.get_script_name(environ))
dispatcher.send(signal=signals.request_started)
signals.request_started.send(sender=self.__class__)
try:
try:
request = self.request_class(environ)
@@ -221,7 +220,7 @@ class WSGIHandler(base.BaseHandler):
response = middleware_method(request, response)
response = self.apply_response_fixes(request, response)
finally:
dispatcher.send(signal=signals.request_finished)
signals.request_finished.send(sender=self.__class__)
try:
status_text = STATUS_CODE_TEXT[response.status_code]