Changes between Version 24 and Version 25 of Signals


Ignore:
Timestamp:
Aug 8, 2008, 7:52:24 AM (16 years ago)
Author:
Henrik Vendelbo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Signals

    v24 v25  
    210210 * `context` -- the `Context` with which the template was rendered.
    211211
     212== Refactoring differences ==
     213
     214[8223] refactored signals and {{{django.dispatch}}} with an eye towards speed. The net result was up to a 90% improvement in the speed of signal handling, but along the way some backwards-incompatible changes were made:
     215
     216 * All handlers now must be declared as accepting {{{**kwargs}}}.
     217 * Signals are now instances of {{{django.dispatch.Signal}}} instead of anonymous objects.
     218 * Connecting, disconnecting, and sending signals are done via methods on the {{{Signal}}} object instead of through module methods in {{{django.dispatch.dispatcher}}}. The module-level methods are deprecated.
     219 * The {{{Anonymous}}} and {{{Any}}} sender options no longer exist. You can still receive signals sent by any sender by using {{{sender=None}}}
     220 
     221So, a quick summary of the code changes you'd need to make:
     222
     223|| '''Before''' || '''After'''  ||
     224|| {{{def my_handler(sender)}}} || {{{def my_handler(sender, **kwargs)}}} ||
     225|| {{{my_signal = object()}}} || {{{my_signal = django.dispatch.Signal()}}} ||   
     226|| {{{dispatcher.connect(my_handler, my_signal)}}} || {{{my_signal.connect(my_handler)}}} ||
     227|| {{{dispatcher.send(my_signal, sender)}}} || {{{my_signal.send(sender)}}} ||
     228|| {{{dispatcher.connect(my_handler, my_signal, sender=Any)}}} || {{{my_signal.connect(my_handler, sender=None)}}} ||
     229
    212230== Other documentation ==
    213231
     
    223241 * [http://satchmoproject.com/ Satchmo]
    224242 * [http://getbanjo.com/ Banjo]
     243 * [http://code.google.com/p/django-announcements/ Django Announcements]
     244 * [http://code.google.com/p/django-evolution/ Django Evolution]
Back to Top